Closed Bug 1591276 Opened 6 years ago Closed 5 years ago

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla77
Tracking Status
firefox71 --- wontfix
firefox72 --- wontfix
firefox73 --- wontfix
firefox74 --- wontfix
firefox77 --- verified
firefox78 --- unaffected

People

(Reporter: hiro, Assigned: jonco)

References

()

Details

Attachments

(2 files)

bp-96c398a7-5476-4c5a-b74f-64eae0191024

I don't know whether there are something we can do, and I don't know what the site actually does, but the site certainly kills Firefox nightly...

Type: task → defect
Component: JavaScript Engine → Memory Allocator

The priority flag is not set for this bug.
:glandium, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mh+mozilla)
Component: Memory Allocator → Untriaged
Flags: needinfo?(mh+mozilla)
Product: Core → Firefox

Hi Mike, would you happen to know which is the most appropriate component for this issue? Thanks!

Flags: needinfo?(mh+mozilla)

It isn't possible to tell why we're using a lot of memory without further information.

The first step would be to get an about:memory report for this page. I tried, but the memory reporter just hung during the process.

Flags: needinfo?(mh+mozilla)

Hi,

Thanks for the details. I was able to reproduce on Windows 10, on Firefox Nightly version 73.0a1 (2019-12-23) (64-bit), beta 72.0b10 (64-bit), and firefox release 71.0.

I've chosen a component so that the issue is reviewed.

Best regards, Clara.

Component: Untriaged → Performance
Product: Firefox → Core
Version: unspecified → Trunk

Since it's a crash, pass it along to the js team.

Component: Performance → JavaScript Engine

Hi,

I've tested this using the latest Nightly version 74.0a1 (2020-01-09) (64-bit) for Windows 10 pro and I’m able to reproduce the issue. Based on this I will mark firefox74 flag as affected as well.

Best,
Clara

Any idea why this is crashing in jemalloc rather that returning null as expected?

Flags: needinfo?(mh+mozilla)

There are few places that MOZ_CRASH() in mozjemalloc, and even less that do so without a message. This one comes from pages_decommit in InitChunk. https://hg.mozilla.org/mozilla-central/annotate/ad7a152bc66c0d411a6fb0b210d675abed9693c7/memory/build/mozjemalloc.cpp#l1297
Bug 1539133 would change the signature to be more explicit, but in this particular crash, it means mmap fails either because of address space exhaustion or because of the number of mappings exceeding 32K. At least that would be the explanation for Linux. For Windows, I'm not sure why VirtualFree would fail in the corresponding code. https://hg.mozilla.org/mozilla-central/annotate/ad7a152bc66c0d411a6fb0b210d675abed9693c7/memory/build/mozjemalloc.cpp#l1288
Do we have crash reports for Windows?

Flags: needinfo?(mh+mozilla)

The Windows crashes are on a different line of code in the same function, so they're not the same thing at all. They suggest allocator metadata corruption.

I just tried open the site in question on Windows 10 (32GB), it doesn't cause the crash at all. It repeatedly shows "script makes the browser slow" (This is not correct words since it's written in Japanese).

After a while I noticed there is an unsent crash report which seems to happened after closing the tab for the site. FWIW, bp-1c0844f2-952b-4866-b12c-af5c40200114

Flags: needinfo?(jcoppeard)
Priority: -- → P1

We're coming through this path because we're retrying an allocation after hitting OOM. As per comment 3 this looks like a crash caused by OOM in jemalloc. I'm not sure what we can do here.

Flags: needinfo?(jcoppeard)

Jon, is there someone we can assign this to look at on another team? Or is this just not actionable at this time. I would like to identify what the next steps are with this bug if possible. I have moved it to a P2 until we figure out what to do with it.

Flags: needinfo?(jcoppeard)
Priority: P1 → P2

Sorry for being slow picking this up. TBH I didn't realise how easy this was to reproduce.

about:memory shows that nursery-malloced-buffers grows very large very quickly (to 10s of GB on my machine).

It seems the page is doing something like:

let str = "";
for (;;) {
  str = "foobar" + str.substring(1);
  str.indexOf("?");
}

It's repeatedly creating a rope and then flattening it (by calling indexOf). This copies the string contents to a new buffer every time so we end up tons of nursery allocated strings with increasingly large buffers attached. These buffers are malloc allocated, and we don't track the memory usage of these at the moment.

Assignee: nobody → jcoppeard
Flags: needinfo?(jcoppeard)

This tracks the total memory used by the nursery's malloced buffers set and trigers a minor GC if it passes some limit. The limit is somewhat arbirarily defined as eight times the nursery capactity - this only fires rarely in normal use but is enough to prevent runaway memory growth in this case.

Depends on D71041

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3309177cef0a Refactor code to reallocate malloced buffers associated with nursery cells r=sfink https://hg.mozilla.org/integration/autoland/rev/ddca597d13b1 Track memory used by malloced buffers associated with nursery cells r=sfink
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Flags: qe-verify+

I wasn't able to reproduce the crash, Clara Guerrero, can you please confirm the fix on the latest Beta?

Flags: needinfo?(cguerrero)

Hi,

I've tested this using Release 76.0 (64-bit), Beta 77.0b8 (64-bit), Firefox Nightly 78.0a1 (2020-05-28) (64-bit) for mac OS 10.14, windows 10 pro and ubuntu 18.04 and I’m also not able to reproduce the crash anymore. Based on this I will mark each respective flag as verified and the bug's status to verified:fixed. Removing qe-verify+ as well.

Best,
Clara

Flags: needinfo?(cguerrero)
Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: