Assertion failure: mRawPtr != nullptr (You can't dereference a NULL RefPtr with operator->().), at /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:34
Categories
(Core :: Networking: HTTP, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr140 | --- | unaffected |
| firefox-esr153 | --- | disabled |
| firefox156 | --- | wontfix |
| firefox157 | --- | wontfix |
| firefox158 | --- | fixed |
People
(Reporter: tsmith, Assigned: kershaw)
References
(Blocks 1 open bug, )
Details
(Keywords: assertion, pernosco, Whiteboard: [necko-triaged])
Attachments
(1 external file)
Found with m-c 20260813-70b193e0c1e1 (--enable-debug)
This was found by visiting a live website with a debug build.
STR:
- Launch browser and visit site
This issue was triggered by visiting http://gthic.com/. A Pernosco session is available here: https://pernos.co/debug/vb6WVJyFN8quGqgr3ZiPJA/index.html
Assertion failure: mRawPtr != nullptr (You can't dereference a NULL RefPtr with operator->().), at /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:343
0|0|libxul.so|std::_Function_handler<void (nsresult), mozilla::net::nsHttpChannel::PrepareToConnect()::$_0::operator()(bool, mozilla::net::DictionaryCacheEntry*) const::{lambda(nsresult)#1}>::_M_invoke(std::_Any_data const&, nsresult&&)|/builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include/c++/11/bits/std_function.h|290|0x2b1
0|1|libxul.so|mozilla::net::DictionaryCacheEntry::CleanupOnCacheData(nsresult)|git:github.com/mozilla-firefox/firefox:netwerk/cache2/Dictionary.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|692|0xa8
0|2|libxul.so|mozilla::detail::RunnableFunction<mozilla::net::DictionaryCacheEntry::OnStopRequest(nsIRequest*, nsresult)::$_0>::Run()|git:github.com/mozilla-firefox/firefox:xpcom/threads/nsThreadUtils.h:e3285238626d45d2ec7ee8941fc1c49615730ba5|535|0x620
0|3|libxul.so|mozilla::RunnableTask::Run()|git:github.com/mozilla-firefox/firefox:xpcom/threads/TaskController.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|721|0x17
0|4|libxul.so|mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&)|git:github.com/mozilla-firefox/firefox:xpcom/threads/TaskController.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|1367|0x5b5
0|5|libxul.so|mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&)|git:github.com/mozilla-firefox/firefox:xpcom/threads/TaskController.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|1190|0x57
0|6|libxul.so|mozilla::TaskController::ProcessPendingMTTask(bool)|git:github.com/mozilla-firefox/firefox:xpcom/threads/TaskController.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|657|0x65
0|7|libxul.so|mozilla::detail::RunnableFunction<mozilla::TaskController::TaskController()::$_0>::Run()|git:github.com/mozilla-firefox/firefox:xpcom/threads/nsThreadUtils.h:e3285238626d45d2ec7ee8941fc1c49615730ba5|535|0x16
0|8|libxul.so|nsThread::ProcessNextEvent(bool, bool*)|git:github.com/mozilla-firefox/firefox:xpcom/threads/nsThread.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|1319|0x5ca
0|9|libxul.so|NS_ProcessNextEvent(nsIThread*, bool)|git:github.com/mozilla-firefox/firefox:xpcom/threads/nsThreadUtils.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|471|0x4f
0|10|libxul.so|mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*)|git:github.com/mozilla-firefox/firefox:ipc/glue/MessagePump.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|83|0xb0
0|11|libxul.so|MessageLoop::Run()|git:github.com/mozilla-firefox/firefox:ipc/chromium/src/base/message_loop.cc:e3285238626d45d2ec7ee8941fc1c49615730ba5|346|0x61
0|12|libxul.so|nsBaseAppShell::Run()|git:github.com/mozilla-firefox/firefox:widget/nsBaseAppShell.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|151|0x28
0|13|libxul.so|nsAppShell::Run()|git:github.com/mozilla-firefox/firefox:widget/gtk/nsAppShell.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|580|0x114
0|14|libxul.so|nsAppStartup::Run()|git:github.com/mozilla-firefox/firefox:toolkit/components/startup/nsAppStartup.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|308|0x64
0|15|libxul.so|XREMain::XRE_mainRun()|git:github.com/mozilla-firefox/firefox:toolkit/xre/nsAppRunner.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|6495|0x154a
0|16|libxul.so|XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&)|git:github.com/mozilla-firefox/firefox:toolkit/xre/nsAppRunner.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|6747|0x5b5
0|17|libxul.so|XRE_main(int, char**, mozilla::BootstrapConfig const&)|git:github.com/mozilla-firefox/firefox:toolkit/xre/nsAppRunner.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|6820|0x122
0|18|firefox-bin|main|git:github.com/mozilla-firefox/firefox:browser/app/nsBrowserApp.cpp:e3285238626d45d2ec7ee8941fc1c49615730ba5|542|0x443
| Assignee | ||
Comment 1•2 months ago
•
|
||
| wrong-comment | ||
The root cause is that mFromStaleCache is stored on the shared nsHostRecord, but HE reads it at callback time to determine whether the delivered answer was stale. HE issues the refresh with RESOLVE_BYPASS_CACHE, so it must return a fresh result. However, if another lookup for the same host calls nsHostResolver::FromCache on another thread before the refresh’s OnARecord callback runs, it can set the shared flag back to true.
| Assignee | ||
Comment 2•2 months ago
|
||
Sorry for the slop below, but I've verified it with the Pernosco session.
Root cause:
The crash is a debug-only assertion: the null dereference lives entirely inside the MOZ_ASSERT argument at the success path of the dictionary-prefetch completion callback in nsHttpChannel::PrepareToConnect:
MOZ_ASSERT(self->mDictDecompress->DictionaryReady());
At the crash, self->mDictDecompress is null and aResult == NS_OK.
This is a lifetime/ordering bug. The prefetch-completion callback's success path assumes mDictDecompress is still alive, but the channel can complete and release it before the async callback runs. Observed state on the crashing channel:
- mIsDictionaryCompressed == false (the response was not dictionary-compressed)
- mShouldSuspendForDictionary == true, but mSuspendedForDictionary == false
- mUsingDictionary == false, mDictDecompress == nullptr
Because the response was not dictionary-compressed, the suspend condition in ContinueProcessNormal2 was never met, so the channel never waited for the prefetch. Reverse-execution to the last write of mDictDecompress lands on:
nsHttpChannel::SetDecompressDictionary(aDictionary=0x0) <- mDictDecompress = nullptr
nsHTTPCompressConv::OnStopRequest(...)
Sequence:
1. PrepareToConnect sets mDictDecompress = aDict, InUse(), mUsingDictionary = true, and starts the async Prefetch(...) callback.
2. Response is not dictionary-compressed, so the channel does not suspend and runs to completion.
3. nsHTTPCompressConv::OnStopRequest calls SetDecompressDictionary(nullptr), which clears mUsingDictionary and nulls mDictDecompress.
4. The still-pending prefetch callback fires with NS_OK and dereferences the now-null mDictDecompress inside the MOZ_ASSERT.
Suggested fix: guard the success path against an already-released dictionary instead of asserting it is live.
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 3•2 months ago
|
||
Updated•2 months ago
|
Comment 5•2 months ago
|
||
| bugherder | ||
Updated•2 months ago
|
Updated•1 month ago
|
Description
•