Open Bug 1742004 Opened 5 years ago Updated 9 days ago

Crash in [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__]

Categories

(Core :: Storage: IndexedDB, defect)

Unspecified
Windows 10
defect

Tracking

()

People

(Reporter: mccr8, Unassigned, NeedInfo)

References

Details

(Keywords: crash, Whiteboard: dom-lws-bugdash-triage)

Crash Data

Crash report: https://crash-stats.mozilla.org/report/index/1e7a896d-5eef-43ac-b890-9b7660211117

MOZ_CRASH Reason: MOZ_CRASH(IPC message size is too large)

Top 10 frames of crashing thread:

0 xul.dll mozilla::ipc::PortLink::SendMessage ipc/glue/MessageLink.cpp:98
1 xul.dll mozilla::ipc::MessageChannel::DispatchMessage ipc/glue/MessageChannel.cpp:1987
2 xul.dll mozilla::ipc::MessageChannel::MessageTask::Run ipc/glue/MessageChannel.cpp:1855
3 xul.dll nsThread::ProcessNextEvent xpcom/threads/nsThread.cpp:1142
4 xul.dll mozilla::ipc::MessagePumpForNonMainThreads::Run ipc/glue/MessagePump.cpp:330
5 xul.dll MessageLoop::RunHandler ipc/chromium/src/base/message_loop.cc:324
6 xul.dll MessageLoop::Run ipc/chromium/src/base/message_loop.cc:306
7 xul.dll static nsThread::ThreadFunc xpcom/threads/nsThread.cpp:390
8 nss3.dll _PR_NativeRunThread nsprpub/pr/src/threads/combined/pruthr.c:399
9 nss3.dll pr_root nsprpub/pr/src/md/windows/w95thred.c:139

I assume this is somehow related to bug 1706036.

See Also: → 1706036

Since the crash volume is low (less than 5 per week), the severity is downgraded to S3. Feel free to change it back if you think the bug is still critical.

For more information, please visit auto_nag documentation.

Severity: S2 → S3

(In reply to Jens Stutte [:jstutte] from comment #1)

I assume this is somehow related to bug 1706036.

This bug seems to be about trying to send too big messages from parent to child.
After a quick look, Reply_LoadKeys can end up doing this only when mOrderedItems is too large. Maybe there's a place where it's not properly synchronized with mValues.

Whiteboard: dom-lws-bugdash-triage

This bug has had no comment from a person since 2024-09-13. Clouseau analysed a recent crash report on its signature; the analysis is below.

Crash report: https://crash-stats.mozilla.org/report/index/d1e30385-8414-426a-b89a-d84a50261119

MOZ_CRASH Reason:

MOZ_CRASH(IPC message size is too large)

Top 10 frames:

0  libxul.so  mozilla::ipc::MessageChannel::Send(std::unique_ptr<IPC::Message, std::default_de...  ipc/glue/MessageChannel.cpp:729
1  libxul.so  mozilla::dom::indexedDB::PBackgroundIDBRequestParent::Send__delete__(mozilla::do...  ipc/ipdl/PBackgroundIDBRequestParent.cpp:117
2  libxul.so  mozilla::dom::indexedDB::(anonymous namespace)::NormalTransactionOp::SendSuccess...  dom/indexedDB/ActorsParent.cpp:19044
3  libxul.so  mozilla::dom::indexedDB::(anonymous namespace)::TransactionDatabaseOperationBase...  dom/indexedDB/ActorsParent.cpp:17612
4  libxul.so  mozilla::dom::indexedDB::(anonymous namespace)::TransactionDatabaseOperationBase...  dom/indexedDB/ActorsParent.cpp
5  libxul.so  NS_ProcessNextEvent(nsIThread*, bool)  xpcom/threads/nsThreadUtils.cpp:471
6  libxul.so  mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*)  ipc/glue/MessagePump.cpp:327
7  libxul.so  nsThread::ThreadFunc(void*)  xpcom/threads/nsThread.cpp:436
8  libnspr4.so  _pt_root  nsprpub/pr/src/pthreads/ptthread.c:198
9  firefox-nightly-bin

There is 1 crash in nightly 162 with buildid 20261115213519.

In the last 30 days, Firefox has 75 crashes (from 50 installations) on esr, 23 crashes (from 21 installations) on release, 8 crashes (from 3 installations) on nightly and 4 crashes (from 3 installations) on beta/DevEdition with this signature.

This signature has been reported since build 20220220190121 (2022-02-20), 1729 days before the build above.

This bug looks actionable because:

  • The parent-process IndexedDB NormalTransactionOp::SendSuccessResult sends a PBackgroundIDBRequest::__delete__ response that is larger than IPC::Channel::kMaximumMessageSize, so PortLink::SendMessage hits MOZ_CRASH("IPC message size is too large").

    1. SendSuccessResult sets kMaxMessageSize to IndexedDatabaseManager::MaxSerializedMsgSize() minus a fixed 10 MB overhead; that pref defaults to IPC::Channel::kMaximumMessageSize.
    2. GetResponse fills responseSize from the structured-clone data length (info.Size()) or key buffer length of each entry only, without per-record serialization overhead; the in-code TODO (bug 1945040) says this does not reflect the real IPC message size.
    3. When the estimate stays below kMaxMessageSize but the serialized response does not, probably for a large getAll-style result, the guard lets it through and Send__delete__ is called.
    4. PortLink::SendMessage finds aMessage->size() > IPC::Channel::kMaximumMessageSize and crashes.

    The crash reason, the IPC message name in the signature, and frames 0-2 (MessageChannel::Send from Send__delete__ at ActorsParent.cpp:19044) fit this chain. Which GetResponse ran and the actual message size are not in this report. The owner should first look at making the GetResponse size estimates, or the 10 MB margin, cover the real serialized size, so that the existing error path is used instead of a crash.

  • The failing code comes from ca73f9471ede (bug 1275062) by :baku.

  • A second, independent analysis found the same failing line but traced it to 64361ca94917 (bug 1943951), so who owns this code is not settled.

Impact

The parent process crashes, so the whole browser closes.

Possible fixes

  • Make each GetResponse size estimate include per-record serialization overhead (key buffers, file/blob arrays, per-entry headers), as the bug 1945040 TODO describes, so that responseSize >= kMaxMessageSize catches these responses and returns NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR instead of crashing.
  • Possibly measure the real serialized size before sending, or check it against IPC::Channel::kMaximumMessageSize with the same error path; callers already handle a failed TransactionOpResult, so the contract does not change.
  • Possibly widen the 10 MB kMaxIDBMsgOverhead margin for getAll-style responses with many records.

How to confirm

Read the IPCMessageSize and IPCMessageLargeBufferShmemFailureSize annotations in this and sibling reports to see how far over the limit the message is and whether a shmem spill failed. An xpcshell test like test_response_too_large.js doing getAll over many records whose clone sizes add up to just under kMaxMessageSize should reproduce the crash instead of the expected error.

Code references:

:abienner, as triage owner, can you have a look please?

Posted automatically by Clouseau, which analyses nightly crashes with an LLM. Nothing above was written or checked by a human.

Posted here because mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__ is another spelling of this bug's signature mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys (frame IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys became IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__); [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__] has been added to its crash signatures.

Flags: needinfo?(abienner)
Crash Signature: [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys] → [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__]

(In reply to Clouseau (:calixte) from comment #4)

Posted here because mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__ is another spelling of this bug's signature mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys (frame IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys became IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__); [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__] has been added to its crash signatures.

Haha, so I think the "another spelling" heuristic is very wrong here, but since IDB does already try and compensate for this and has mechanisms we can easily adjust and therefore is more actionable, and now there's also a quite long comment about the IDB situation, I'm morphing this bug to be about IDB. I'll ping :calixte on slack to tighten up the heuristic / make it more deterministic.

Crash Signature: [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__] → [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__]
Component: Storage: localStorage & sessionStorage → Storage: IndexedDB
Summary: Crash in [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundLSSnapshot::Reply_LoadKeys] → Crash in [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PBackgroundIDBRequest::Msg___delete__]
You need to log in before you can comment on or make changes to this bug.