High CPU usage and memory allocation in mozglue!BaseAllocator and xul!js::ErrorObject::getStack
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
Performance Impact | ? |
People
(Reporter: thisismyidashish, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
Steps to reproduce:
OS: Windows 10
I had few tabs open. Then suddently, CPU usage of one of firefox.exe went high to 2 core 100% usage and memory became ~2 GB for this firefox.exe which is ~10x higher than other firefox.exe processes.
Actual results:
Memory usage for one of firefox.exe went ~2GB and CPU consumption was 100% for 2 cores. This happened continuously for ~10 mins until i crashed the process. I took a dump before crashing.
I also have Perfview profiler cpu profile but somehow bugzilla is not able to upload 32 MB file. I have attached snippet view which shows offending stack. Please ping me for perfview profile.
Expected results:
I have taken PerfView profiler trace and it shows high CPU usage because of critical section entries from inside mem allocator. This explains both symptoms.
This looks like a bug. Thread 3900 seems to go into a infinite loop allocating and freeing memory.
2 such high cpu and memory consumption stacks are shown below.
I have a dump of process but i am not sure if it contains any of my secrets/personal information.
Name
OTHER <<vcruntime140!memset_repmovs>>
- mozglue!BaseAllocator::realloc
|+ mozglue!moz_arena_realloc
| + xul!js::JSStringBuilder::finishString
| |+ xul!JS::BuildStackString
| | + xul!js::ErrorObject::getStack_impl
| | + xul!js::ErrorObject::getStack
| | + OTHER <<?!?>>
| | + BROKEN
| | + Thread (3900) CPU=8016ms (MainThread)
Name
OTHER <<ntdll!RtlEnterCriticalSection>>
- mozglue!BaseAllocator::realloc
|+ mozglue!moz_arena_realloc
| + xul!mozilla::Vector::growStorageBy
| |+ xul!js::StringBuffer::append
| ||+ xul!JS::BuildStackString
| || + xul!js::ErrorObject::getStack_impl
| || + xul!js::ErrorObject::getStack
| || + OTHER <<?!?>>
| || + BROKEN
| || + Thread (3900) CPU=8016ms (MainThread)
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::JavaScript Engine' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Comment 2•3 years ago
|
||
Perfview profile link: https://drive.google.com/file/d/1zeE8t8KlfxcAI4-D4EWCj8x9KaJpoZDb/view?usp=sharing
Reporter | ||
Comment 3•2 years ago
|
||
Reporter | ||
Comment 4•2 years ago
|
||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
The profile suggests that many calls to ErrorObject::getStack
are made in a repeated manner.
So, some code is likely going in a loop making allocations, and re-attempting to make more allocations as it fails to complete some initialization.
To find more about this issue, I recommend:
- To check about:performance to know which website/process is causing this issue.
- To reproduce this issue and to use the Firefox profiler to resolve the OTHER and BROKEN symbols, as Windows profiler does not know how to iterate over JIT stacks.
Reporter | ||
Comment 6•2 years ago
|
||
(In reply to Nicolas B. Pierron [:nbp] {pto until 30/05} from comment #5)
The profile suggests that many calls to
ErrorObject::getStack
are made in a repeated manner.
So, some code is likely going in a loop making allocations, and re-attempting to make more allocations as it fails to complete some initialization.To find more about this issue, I recommend:
- To check about:performance to know which website/process is causing this issue.
- To reproduce this issue and to use the Firefox profiler to resolve the OTHER and BROKEN symbols, as Windows profiler does not know how to iterate over JIT stacks.
I can't seem to reproduce the issue as i don't know which website was causing issue. I restarted firefox.
I will take a look at profiler next time it happens.
I have dump of process and i can run specific commands that can provide that info though.
How do you resolve the symbols in a dump ?
Comment 7•2 years ago
|
||
(In reply to AshishNegi from comment #6)
I have dump of process and i can run specific commands that can provide that info though.
How do you resolve the symbols in a dump ?
I'm not sure but you can try the instructions on this page: https://github.com/rust-minidump/rust-minidump/tree/main/minidump-stackwalk#analyzing-firefox-minidumps
But even the resolved symbols are unlikely to tell us which page or which JS function was responsible, because they'll only resolve C++ functions.
We have bug 1530552 for making Perfview able to walk JS / JIT stacks.
Comment 8•2 years ago
|
||
(In reply to AshishNegi from comment #6)
I can't seem to reproduce the issue as i don't know which website was causing issue. I restarted firefox.
Thanks for trying!
I will mark this bug as incomplete in the mean time. Feel free to re-open this bug if you have more information.
Description
•