Crash when profiling with native allocations
Categories
(Core :: Gecko Profiler, defect, P3)
Tracking
()
People
(Reporter: nical, Unassigned)
References
Details
(Whiteboard: [sp3])
Crash Data
Crash report: https://crash-stats.mozilla.org/report/index/10ccd6d1-ccfa-40b3-b270-97b800240730
I hit the same crash reliably if the profiler settings include "native allocations".
Comment 1•2 years ago
|
||
Hey nical !
Would you be able to upload a pernosco run of that?
To me this rings a bell with bug 1753976
Comment 2•2 years ago
|
||
(ni just in case you get a chance to capture a pernosco session)
Comment 4•2 years ago
|
||
Copying crash signatures from duplicate bugs.
Comment 5•2 years ago
|
||
Caught this under rr and made a pernosco: https://pernos.co/debug/GrWGGGBFGWdPECGSJ8GN-A/index.html, clearing nical's NI and adding another one for Nazım.
Comment 6•2 years ago
|
||
It looks like we try to add a marker and capture a stack while the thread is unregistered, this doesn't look right.
Comment 8•2 years ago
|
||
This is the information Paul provided in Bug 1919685:
I see this crash when capturing native allocation:
#01: WasmTrapHandler(int, siginfo_t*, void*) (/mnt/dev/moz/prof_hook/js/src/wasm/WasmSignalHandlers.cpp:796)
#02: ??? (/lib/x86_64-linux-gnu/libc.so.6 + 0x3c050)
#03: DoSharedSample(bool, unsigned int, mozilla::profiler::ThreadRegistrationUnlockedReaderAndAtomicRWOnThread const&, JS::ProfilingFrameIterator::Frame*, Registers const&, unsigned long, unsigned long, ProfileBuffer&, mozilla::StackCaptureOptions) (/mnt/dev/moz/prof_hook/tools/profiler/core/platform.cpp:2932)
#04: profiler_capture_backtrace_into(mozilla::ProfileChunkedBuffer&, mozilla::StackCaptureOptions)::$_0::operator()(mozilla::profiler::ThreadRegistration::OnThreadRef) const (/mnt/dev/moz/prof_hook/tools/profiler/core/platform.cpp:7679)
#05: profiler_capture_backtrace_into(mozilla::ProfileChunkedBuffer&, mozilla::StackCaptureOptions) (/mnt/dev/moz/prof_hook/tools/profiler/core/platform.cpp:7662)
#06: mozilla::profiler::profiler_add_native_allocation_marker(long, unsigned long) (/mnt/dev/moz/prof_hook/tools/profiler/core/memory_hooks.cpp:113)
#07: mozilla::profiler::AllocCallback(void*, unsigned long) (/mnt/dev/moz/prof_hook/tools/profiler/core/memory_hooks.cpp:417)
#08: replace_malloc(unsigned long) (/mnt/dev/moz/prof_hook/tools/profiler/core/memory_hooks.cpp:478)
#09: moz_xmalloc (/mnt/dev/moz/prof_hook/memory/mozalloc/mozalloc.cpp:53)
#10: ProfilingStack::ensureCapacitySlow() (/mnt/dev/moz/prof_hook/js/src/vm/ProfilingStack.cpp:41)
[Parent 1216454, IPC I/O Parent] WARNING: [1.1]: Dropping message '<null>'; no connection to unknown peer F0B71BB5A460A027.94D72400492E40E2: file /mnt/dev/moz/prof_hook/ipc/glue/NodeController.cpp:364
#11: nsComponentManagerImpl::GetServiceByContractID(char const*, nsID const&, void**) (/mnt/dev/moz/prof_hook/xpcom/components/nsComponentManager.cpp:1166)
#12: nsGetServiceByContractID::operator()(nsID const&, void**) const (/mnt/dev/moz/prof_hook/xpcom/components/nsComponentManagerUtils.cpp:241)
#13: WatchdogMain(void*) (/mnt/dev/moz/prof_hook/js/xpconnect/src/XPCJSContext.cpp:521)
#14: _pt_root (/mnt/dev/moz/prof_hook/nsprpub/pr/src/pthreads/ptthread.c:204)
#15: set_alt_signal_stack_and_start(PthreadCreateParams*) (/mnt/dev/moz/prof_hook/mozglue/interposers/pthread_create_interposer.cpp:81)
#16: ??? (/lib/x86_64-linux-gnu/libc.so.6 + 0x89144)
#17: ??? (/lib/x86_64-linux-gnu/libc.so.6 + 0x1097dc)
#18: ??? (???:???)Using a recent build from mercurial, with Bug 1917205 applied, running on Linux on amd64.
STR:
- Open firefox
- Visit profiler.firefox.com to enable the profiler, (click the button there etc).
- Click the little arrow next to the profiler symbol in the toolbar,
- Choose Edit Settings
- Enable "Memory Tracking" and "Native Allocations"
- Start capturing with the profiler.
- Visit reddit.com or similarly "sufficiently complex" website and look around for a minute.
- The browser or a process should crash in about 15 seconds. Well, it shouldn't, that's the observed behaviour.
This is a different signature from Bug 1917205, I don't believe they're related except that they're in the same feature and Bug 1917205 crashed at an earlier point masking this problem.
I can also reproduce it locally. Here's a crash reporter entry with the correct stacks:
https://crash-stats.mozilla.org/report/index/4ab8f05f-73a5-4aa8-b448-453580241014
It does seem weird. I will look into it a bit more.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•1 year ago
|
Comment 9•1 year ago
|
||
I wanted to use the native allocations feature today, and encountered this once again :-(
Comment 10•1 year ago
•
|
||
Nazim and I had a look at the Pernosco trace, and it looks like the crash is coming from a huge allocation in the function prelude for DoSharedSample. Looking at the code, we seem to be trying to allocate 180kb of memory, and zero-ing it out. We crash after a few iterations of zero-ing the data. We think that this might be from the ProfilerNativeStack object that we allocate (which is 16kb), but that's still only a small part of the 180kb that we need to track down.
Description
•