Closed Bug 1998185 Opened 1 year ago Closed 11 months ago

Crash in [@ NS_InputStreamIsBuffered]

Categories

(Core :: Networking, defect, P1)

Unspecified
All
defect

Tracking

()

RESOLVED FIXED
148 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox145 --- wontfix
firefox146 + fixed
firefox147 + fixed
firefox148 + fixed

People

(Reporter: valentin, Assigned: kershaw)

References

(Depends on 1 open bug)

Details

(Keywords: crash, Whiteboard: [necko-triaged] [necko-priority-queue])

Crash Data

Attachments

(3 external files)

Crash report: https://crash-stats.mozilla.org/report/index/f61604ae-0d6b-4cfe-ba73-f31bd0250821

Reason:

EXCEPTION_ACCESS_VIOLATION_READ

Top 10 frames:

0  xul.dll  NS_InputStreamIsBuffered(nsIInputStream*)  xpcom/io/nsStreamUtils.cpp:732
1  xul.dll  mozilla::nsMultiplexInputStream::StreamData::Initialize(nsIInputStream*)  xpcom/io/nsMultiplexInputStream.h:77
2  xul.dll  mozilla::nsMultiplexInputStream::AppendStream(nsIInputStream*)  xpcom/io/nsMultiplexInputStream.cpp:114
3  xul.dll  mozilla::nsMultiplexInputStream::Clone(nsIInputStream**)  xpcom/io/nsMultiplexInputStream.cpp:1054
4  xul.dll  mozilla::dom::StreamBlobImpl::CreateInputStream(nsIInputStream**, mozilla::Er...  dom/file/StreamBlobImpl.cpp:137
5  xul.dll  mozilla::dom::BlobImpl::GetSendInfo(nsIInputStream**, unsigned long long*, ns...  dom/file/BlobImpl.cpp:72
6  xul.dll  mozilla::dom::XMLHttpRequestMainThread::SendInternal(mozilla::dom::BodyExtrac...  dom/xhr/XMLHttpRequestMainThread.cpp:3166
7  xul.dll  mozilla::dom::BodyExtractor<const mozilla::dom::URLSearchParams>::BodyExtract...  dom/fetch/BodyExtractor.h:33
7  xul.dll  mozilla::dom::XMLHttpRequestMainThread::Send(mozilla::dom::Nullable<mozilla::...  dom/xhr/XMLHttpRequestMainThread.cpp:3061
8  xul.dll  mozilla::dom::SendRunnable::RunOnMainThread(mozilla::ErrorResult&)  dom/xhr/XMLHttpRequestWorker.cpp:1329

I was looking at bug 1879917 and noticed it started spiking about a month ago.

Looking at the dump in https://crash-stats.mozilla.org/report/index/625afa62-029e-4962-a417-036180251102
in nsInputStreamPump::CreateBufferedStreamIfNeeded

mAsyncStream	NULL	nsCOMPtr<nsIAsyncInputStream>
	 [Raw View]	{mRawPtr=0x0000000000000000 <NULL> }	nsCOMPtr<nsIAsyncInputStream>
this	0x000001e8e54801f0 {mRefCnt={mValue=2 } mState=4 mLoadGroup=NULL ...}	nsInputStreamPump *
	 nsIInputStreamPump	{...}	nsIInputStreamPump
	 nsIInputStreamCallback	{...}	nsIInputStreamCallback
	 nsIThreadRetargetableRequest	{...}	nsIThreadRetargetableRequest
	 mRefCnt	{mValue=2 }	mozilla::ThreadSafeAutoRefCnt
	 mState	4	unsigned int
	 mLoadGroup	NULL	nsCOMPtr<nsILoadGroup>
	 mListener	NULL	nsCOMPtr<nsIStreamListener>
	 mTargetThread	NULL	nsCOMPtr<nsISerialEventTarget>
	 mLabeledMainThreadTarget	NULL	nsCOMPtr<nsISerialEventTarget>
	 mStream	NULL	nsCOMPtr<nsIInputStream>
	 mAsyncStream	NULL	nsCOMPtr<nsIAsyncInputStream>
	 mStreamOffset	0	unsigned __int64
	 mStreamLength	0	unsigned __int64
	 mSegSize	0	unsigned int
	 mSegCount	0	unsigned int
	 mStatus	NS_BINDING_ABORTED (2152398850)	nsresult
	 mSuspendCount	0	unsigned int
	 mLoadFlags	0	unsigned int
	 mIsPending	false	bool
	 mProcessingCallbacks	false	bool
	 mWaitingForInputStreamReady	false	bool
	 mCloseWhenDone	false	bool
	 mRetargeting	false	bool
	 mAsyncStreamIsBuffered	false	bool
	 mOffMainThread	false	const bool
	 mMutex	{mMutex=0x000001e8e5480288 {0xffffffffffffffff, 0x00000001fffffffe, 0x0000000000002974, 0x0000000000000000, ...} }	mozilla::RecursiveMutex

mState == 4 means it's in nsInputStreamPump::STATE_DEAD

The bug is marked as tracked for firefox146 (beta). We have limited time to fix this, the soft freeze is in 13 days. However, the bug still isn't assigned.

:jimm, could you please find an assignee for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(jmathies)

This is a reminder regarding comment #2!

The bug is marked as tracked for firefox146 (beta). We have limited time to fix this, the soft freeze is in 7 days. However, the bug still isn't assigned.

This is a reminder regarding comment #2!

The bug is marked as tracked for firefox146 (beta). We have limited time to fix this, the soft freeze is in a day. However, the bug still isn't assigned.

This looks like a network-related API rather than media. I am going to move the component to network

Component: Audio/Video → Networking
Flags: needinfo?(jmathies)

The stacktrace from the recent crashes:

0 	libxul.so 	NS_InputStreamIsBuffered(nsIInputStream*) 	/usr/src/debug/firefox/firefox-145.0/xpcom/io/nsStreamUtils.cpp:732 	context
1 	libxul.so 	nsInputStreamPump::CreateBufferedStreamIfNeeded() 	/usr/src/debug/firefox/firefox-145.0/netwerk/base/nsInputStreamPump.cpp:744 	cfi
2 	libxul.so 	nsInputStreamPump::PeekStream(void (*)(void*, unsigned char const*, unsigned int), void*) 	/usr/src/debug/firefox/firefox-145.0/netwerk/base/nsInputStreamPump.cpp:78 	inlined
2 	libxul.so 	mozilla::net::nsHttpChannel::CallOnStartRequest() 	/usr/src/debug/firefox/firefox-145.0/netwerk/protocol/http/nsHttpChannel.cpp:2390 	cfi
3 	libxul.so 	mozilla::net::nsHttpChannel::ContinueOnStartRequest3(nsresult) 	/usr/src/debug/firefox/firefox-145.0/netwerk/protocol/http/nsHttpChannel.cpp:9106 	inlined
3 	libxul.so 	mozilla::net::nsHttpChannel::ContinueOnStartRequest2(nsresult) 	/usr/src/debug/firefox/firefox-145.0/netwerk/protocol/http/nsHttpChannel.cpp:9095 	inlined
3 	libxul.so 	mozilla::net::nsHttpChannel::ContinueOnStartRequest1(nsresult) 	/usr/src/debug/firefox/firefox-145.0/netwerk/protocol/http/nsHttpChannel.cpp:9068 	cfi
4 	libxul.so 	mozilla::net::nsHttpChannel::OnStartRequest(nsIRequest*) 	/usr/src/debug/firefox/firefox-145.0/netwerk/protocol/http/nsHttpChannel.cpp:8930 	cfi
5 	libxul.so 	nsInputStreamPump::OnStateStart() 	/usr/src/debug/firefox/firefox-145.0/netwerk/base/nsInputStreamPump.cpp:524 	inlined
5 	libxul.so 	nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) 	/usr/src/debug/firefox/firefox-145.0/netwerk/base/nsInputStreamPump.cpp:426 	

The above trace shows PeekStream is called from CallOnStartRequest here, which implies mTransactionPump is non-null. What’s puzzling is that the stack also shows ContinueOnStartRequest1, which only runs when the channel already has an error status (otherwise we’d enter the other branch and call ProcessResponse).
Anyways, the crash report indicates mAsyncStream is null, but the root cause isn’t clear yet. I’ll add a null check and some diagnostic assertions to try to catch where this is happening.

Severity: -- → S3
Priority: -- → P1
Whiteboard: [necko-triaged] [necko-priority-queue]
Assignee: nobody → kershaw
Status: NEW → ASSIGNED

The crash count spikes in Firefox 145, which lines up with the large nsHttpChannel changes for the compression dictionary work.
Randell, could this be related to one of the compression-dictionary patches?

Flags: needinfo?(rjesup)
Pushed by kjang@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f27ba12b44bf https://hg.mozilla.org/integration/autoland/rev/1ce1e9514327 Check if mAsyncStream is null in nsInputStreamPump::PeekStream, r=necko-reviewers,valentin
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
Attachment #9531673 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined: Possible crash
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: This patch only adds a null check
  • String changes made/needed: None
  • Is Android affected?: yes

The date for the beginning of "new" crashes from this appears to match up with the Compression Dictionary landing on 2025/10/8 (first crash appears to be buildid 10/9, though there are a handful of much older crashes). I'll look into why this is happening

Flags: needinfo?(rjesup)
Attachment #9531673 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

:kershaw do you want to uplift this for the 146 dot release this week?

Flags: needinfo?(kershaw)

(In reply to Dianna Smith [:diannaS] from comment #15)

:kershaw do you want to uplift this for the 146 dot release this week?

Yeah, I think it's no harm to uplift this. Thanks.

Flags: needinfo?(kershaw)
Attachment #9533389 - Flags: approval-mozilla-release?

firefox-release Uplift Approval Request

  • User impact if declined: Possible crash
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: N/A
  • Risk associated with taking this patch: low
  • Explanation of risk level: This patch only adds a null check.
  • String changes made/needed: N/A
  • Is Android affected?: yes
Attachment #9533389 - Flags: approval-mozilla-release? → approval-mozilla-release+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: