Closed Bug 1175898 Opened 9 years ago Closed 9 years ago

crash in mozilla::CrossProcessMutex::ShareToProcess(int)

Categories

(Core :: Graphics, defect)

Unspecified
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox42 --- fixed

People

(Reporter: snorp, Assigned: blassey)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file, 1 obsolete file)

This bug was filed from the Socorro interface and is 
report bp-a9524f91-ba27-4982-9c3f-44b272150618.
=============================================================

I get this crash at startup with APZ enabled on 6/18 Mac nightly
This looks to be fallout from bug 1161166:

[26376] WARNING: request for ports for pid 26376, but we're the chrome process
: file /builds/slave/m-cen-m64-d-000000000000000000/build/src/ipc/glue/SharedMemoryBasic_mach.cpp, line 225
[26376] WARNING: Unable to get ports for process.
: file /builds/slave/m-cen-m64-d-000000000000000000/build/src/ipc/glue/SharedMemoryBasic_mach.cpp, line 572
[26376] WARNING: request for ports for pid 26376, but we're the chrome process
: file /builds/slave/m-cen-m64-d-000000000000000000/build/src/ipc/glue/SharedMemoryBasic_mach.cpp, line 225
[26376] WARNING: Unable to get ports for process.
: file /builds/slave/m-cen-m64-d-000000000000000000/build/src/ipc/glue/SharedMemoryBasic_mach.cpp, line 572
Hit MOZ_CRASH() at /builds/slave/m-cen-m64-d-000000000000000000/build/src/ipc/glue/CrossProcessMutex_posix.cpp:146
Assignee: nobody → blassey.bugs
Blocks: 1161166
Note that this only happens if layers.progressive-paint is set to true. The default value is false on OS X.
Happening on B2G Desktop as well (OS X + apzc). Crash at startup.
Attached patch share_to_self.patch (obsolete) — Splinter Review
I didn't consider a process sharing memory with itself. Snorp tried this and said it works under the conditions (progressive tiles and apz enabled) that he saw it crash without this patch.
Attachment #8624450 - Flags: review?(wmccloskey)
Comment on attachment 8624450 [details] [diff] [review]
share_to_self.patch

Review of attachment 8624450 [details] [diff] [review]:
-----------------------------------------------------------------

Canceling for now because I think we need a test for this.

Could you please test this using the IPDL unit tests? Unfortunately they're not run on tinderbox, but they're useful when modifying IPDL. You need to build with --enable-ipdl-tests in your mozconfig. Then, from $OBJDIR/dist/bin, you can do:

./run-mozilla.sh ./ipdlunittest TestShmem

The test should run in both threaded and cross-process mode.

If the test doesn't fail without the mod_refs thing I mentioned below, can you change it so that it does?

::: ipc/glue/SharedMemoryBasic_mach.cpp
@@ +565,5 @@
>  SharedMemoryBasic::ShareToProcess(base::ProcessId pid,
>                                    Handle* aNewHandle)
>  {
> +  if (pid == getpid()) {
> +    *aNewHandle = mPort;

I'm worried about ownership here. We're going to end up with two SharedMemoryBasics here that use the same port. When either one dies, we'll call mach_port_deallocate and the port will be gone. That doesn't sound like what we want. I think maybe we want to call mach_port_mod_refs here with a delta of +1.
Attachment #8624450 - Flags: review?(wmccloskey)
you're right about ownership, good catch. And mod_refs is the right thing to do here. The tests, however, don't run (at least on my machine). I also tried running them on Aurora, so this isn't a recent regression.

[23984] WARNING: parent WaitForMessage() failed: 0x10004003 (ipc/rcv) timed out: file /Users/blassey/src/mozilla-aurora/ipc/glue/GeckoChildProcessHost.cpp, line 756
TEST-UNEXPECTED-FAIL | TestShmem | problem launching subprocess
[23984] ###!!! ABORT: failed test: file ../../../../dist/include/mozilla/_ipdltest/IPDLUnitTests.h, line 50
[23984] ###!!! ABORT: failed test: file ../../../../dist/include/mozilla/_ipdltest/IPDLUnitTests.h, line 50
Segmentation fault: 11

That failure is the timeout receiving the bootstrapped mach port from the child.
Attachment #8624450 - Attachment is obsolete: true
Attachment #8625306 - Flags: review?(wmccloskey)
update, commenting out this line http://mxr.mozilla.org/mozilla-central/source/toolkit/xre/nsXREDirProvider.cpp#108 lets the ipdl tests run and the Shmem tests pass
Attachment #8625306 - Flags: review?(wmccloskey) → review+
https://hg.mozilla.org/mozilla-central/rev/e6c3f42f0534
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: