Closed Bug 1524237 Opened 6 years ago Closed 3 years ago

Crash in mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Msg_SetClipboard on attempt to copy much text into the clipboard

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

defect

Tracking

()

VERIFIED FIXED
102 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox-esr91 --- wontfix
firefox89 --- wontfix
firefox90 --- wontfix
firefox91 --- wontfix
firefox100 --- wontfix
firefox101 --- wontfix
firefox102 --- verified

People

(Reporter: aryx, Assigned: edgar)

References

(Regression)

Details

(Keywords: crash, regression, reproducible, Whiteboard: widget-next)

Crash Data

Attachments

(1 file)

This bug is for crash report bp-5e257e8c-18d7-4fa1-84c0-f112b0190131.

Top 10 frames of crashing thread:

0 xul.dll mozilla::ipc::ProcessLink::SendMessage ipc/glue/MessageLink.cpp:152
1 xul.dll mozilla::ipc::MessageChannel::Send ipc/glue/MessageChannel.cpp:995
2 xul.dll mozilla::dom::PContentChild::SendSetClipboard ipc/ipdl/PContentChild.cpp:2711
3 xul.dll nsClipboardProxy::SetData widget/nsClipboardProxy.cpp:36
4 xul.dll static nsresult SelectionCopyHelper dom/base/nsCopySupport.cpp:269
5 xul.dll nsCopySupport::FireClipboardEvent dom/base/nsCopySupport.cpp:801
6 xul.dll nsClipboardCommand::DoCommand dom/base/nsGlobalWindowCommands.cpp:525
7 xul.dll nsControllerCommandTable::DoCommand dom/commandhandler/nsControllerCommandTable.cpp:140
8 xul.dll nsBaseCommandController::DoCommand dom/commandhandler/nsBaseCommandController.cpp:123
9 xul.dll nsresult nsXBLPrototypeHandler::DispatchXBLCommand dom/xbl/nsXBLPrototypeHandler.cpp:541

Reproduces on Ubuntu 16.10 (tested with 64.0 64-bit) and Windows 8.1 (latest Nightly 67.0a1 32-bit and 65.0 64-bit)

Steps to reproduce:

  1. Open https://taskcluster-artifacts.net/HYfODDPwRwqqFSFf1QzG2w/0/public/logs/live_backing.log
  2. Hit Ctrl+A (crashes on Linux, auto copy?)
  3. Hit Ctrl+C

Linux crash report: bp-1f114fb3-f707-4239-8622-3a3ac0190131

Priority: -- → P3
Whiteboard: widget-next

I reproduced this with bp-d1490658-2ef2-434a-8982-3cede0190629

STR:

  1. Create a 64 MB file, e.g. python -c 'print("x x "*16777216)' > /tmp/quitebig.txt
  2. Hit Ctrl-A. On Linux, selecting text puts the text on the primary clipboard.
  3. If not on Linux, press Ctrl-C to put the text on the clipboard.

Expected:

  • Text is selected, and put on the clipboard.
  • Alternatively, the text is not put on the clipboard, but an error is reported to the global JS console / stderr.

Actual:

  • Tab crashes.
Crash Signature: [@ mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Msg_SetClipboard] → [@ mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::MessageChannel::Send | mozilla::ipc::IProtocol::ChannelSend | IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::MessageChannel::Send | …

The issue is that there is an attempt to serialize the whole nsTransferable to send it over IPC. There used to be a file-based cache for large clipboard data (which results in a reasonably-sized IPC message), but that was disabled for content processes because opening files is not allowed in the content process (bug 1482540).

There is some more context on this cache and its behavior at https://bugzilla.mozilla.org/show_bug.cgi?id=1433030#c20 and the linked bugs.

To fix this bug without regressing on behavior (i.e. still being able to copy lots of data), the clipboard content should be shared separately from the main IPC message when it's too large.

See Also: → 1482540
Crash Signature: IPC_Message_Name=PContent::Msg_SetClipboard] → IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard]

Bug 1564196 comment 1 says this may be a regression from 2015 bug 1071562.

The 67 MB log file that crashed Firefox can be selected and copied in Chrome. Safari, however, won't even select the text.

Severity: critical → S1
Crash Signature: IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard] → IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard] [@ mozilla::ipc::MessageChannel::Send | mozilla::dom::PContentChild::SendSetClipboard | IPC_Message_Name=PContent::M…
Keywords: reproducible
Priority: P3 → P1
Regressions: 1071562
Severity: S1 → S2
Regressed by: 1071562
No longer regressions: 1071562
See Also: → 1719760

Added a signature

Crash Signature: IPC_Message_Name=PContent::Msg_SetClipboard] → IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard]
Has Regression Range: --- → yes

Gian-Carlo, this is a P1 bug but currently doesn't have an owner. From what I can tell based on the crash reports, it affects all platforms. Would you be able to assign this to someone, or lower the priority to a P2? Thank you!

Flags: needinfo?(gpascutto)

We won't get to this right away, but it definitely looks like something that should be on our radar.

Flags: needinfo?(gpascutto)
Priority: P1 → P2
Blocks: 1754803
Crash Signature: IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard] → IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard] [@ OOM | large | NS_ABORT_OOM | mozilla::dom::CharacterData::SubstringData ]
Whiteboard: widget-next → widget-next,[win:stability]

This is a copy-paste issue caused by the message size limitation in IPC.

A fix for this could use Shmems to pass the data instead of strings in IPCDataTransferData. The right nexus point for this decision appears to be nsContentUtils::TransferableToIPCTransferable, which already "promotes" C-strings to Shmems but uses nsStrings for wide strings. It could use the same "Shmem promotion" for wide-strings, and the other data types. In all cases, the decision should be based on message size, since allocating and copying to Shmem uses resources and time and is used to avoid this failure.

Component: Widget → DOM: Copy & Paste and Drag & Drop
Whiteboard: widget-next,[win:stability] → widget-next
Severity: S2 → --
Priority: P2 → --

Edgar, this may be interesting to you to consider for other recent related clipboard work.
(And I think we need to assess the severity/priority as well.)

Flags: needinfo?(echen)
Crash Signature: IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard] [@ OOM | large | NS_ABORT_OOM | mozilla::dom::CharacterData::SubstringData ] → IPC_Message_Name=PContent::Msg_SetClipboard] [@ mozilla::ipc::PortLink::SendMessage | IPC_Message_Name=PContent::Reply_GetClipboard] [@ OOM | large | NS_ABORT_OOM | mozilla::dom::CharacterData::SubstringData ] [@ mozilla::ipc::IProtocol::ChannelSend | …
Assignee: nobody → echen
Severity: -- → S2
Flags: needinfo?(echen)

Edgar, given the low volume, should this be S3 instead of S2?

Flags: needinfo?(echen)

(In reply to Marco Castelluccio [:marco] from comment #13)

Edgar, given the low volume, should this be S3 instead of S2?

The volume is low, but quite easy to reproduce, so I am inclined to keep this S2.

Flags: needinfo?(echen)
Depends on: 1768597, 1732920
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0e46a4d44e2c Use Shmem for sending large string data in IPCDataTransfer; r=NeilDeakin
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch

I’ve reproduced this signature crash with Fx 97.0a1 (2022-01-01) on Windows 10.
Verified fixed with Fx 103.0a1 (2022-06-07) and Fx 102.0b5 on Windows 10, macOS 12.1 and Ubuntu 20.04.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: