Closed Bug 1645786 Opened 3 months ago Closed 3 months ago

[socket process] Assertion failure: XRE_IsParentProcess(), at /builds/worker/checkouts/gecko/ipc/glue/InputStreamUtils.cpp:272

Categories

(Core :: Networking, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: kershaw, Assigned: kershaw)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(2 files, 1 obsolete file)

task 2020-06-15T10:51:00.851Z] 10:51:00     INFO - GECKO(2778) | Assertion failure: XRE_IsParentProcess(), at /builds/worker/checkouts/gecko/ipc/glue/InputStreamUtils.cpp:272
[task 2020-06-15T10:51:00.855Z] 10:51:00     INFO -  Initializing stack-fixing for the first stack frame, this may take a while...
[task 2020-06-15T10:51:12.386Z] 10:51:12     INFO - GECKO(2778) | #01: nsBufferedInputStream::Deserialize(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [netwerk/base/nsBufferedStreams.cpp:649]
[task 2020-06-15T10:51:12.387Z] 10:51:12     INFO - GECKO(2778) | #02: mozilla::ipc::InputStreamHelper::DeserializeInputStream(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [ipc/glue/InputStreamUtils.cpp:357]
[task 2020-06-15T10:51:12.390Z] 10:51:12     INFO - GECKO(2778) | #03: nsMultiplexInputStream::Deserialize(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [xpcom/io/nsMultiplexInputStream.cpp:1026]
[task 2020-06-15T10:51:12.391Z] 10:51:12     INFO - GECKO(2778) | #04: mozilla::ipc::InputStreamHelper::DeserializeInputStream(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [ipc/glue/InputStreamUtils.cpp:357]
[task 2020-06-15T10:51:12.391Z] 10:51:12     INFO - GECKO(2778) | #05: mozilla::ipc::DeserializeIPCStream(mozilla::ipc::IPCStream const&) [ipc/glue/IPCStreamUtils.cpp:295]
[task 2020-06-15T10:51:12.392Z] 10:51:12     INFO - GECKO(2778) | #06: mozilla::ipc::DeserializeIPCStream(mozilla::Maybe<mozilla::ipc::IPCStream> const&) [ipc/glue/IPCStreamUtils.cpp:303]
[task 2020-06-15T10:51:12.392Z] 10:51:12     INFO - GECKO(2778) | #07: mozilla::net::HttpTransactionChild::RecvInit(unsigned int const&, mozilla::net::HttpConnectionInfoCloneArgs const&, mozilla::net::nsHttpRequestHead const&, mozilla::Maybe<mozilla::ipc::IPCStream> const&, unsigned long const&, bool const&, unsigned long const&, unsigned char const&, unsigned long const&, unsigned int const&, unsigned int const&, bool const&, unsigned long const&, bool const&, mozilla::Maybe<mozilla::net::H2PushedStreamArg> const&, mozilla::Maybe<mozilla::net::PInputChannelThrottleQueueChild*> const&, bool const&) [netwerk/protocol/http/HttpTransactionChild.cpp:180]
[task 2020-06-15T10:51:12.393Z] 10:51:12     INFO - GECKO(2778) | #08: mozilla::net::PHttpTransactionChild::OnMessageReceived(IPC::Message const&) [s3:gecko-generated-sources-l1:a6265be9f362522a0e665e06fbb23e4d45a0975a57788b56660e854fe5b47708d1552548e55ce3796dad85e88bf18f6b31b0b40bd50f629c8e72fac919b8706d/ipc/ipdl/PHttpTransactionChild.cpp::567]

I think change this assertion to MOZ_ASSERT(XRE_IsParentProcess() || XRE_IsSocketProcess()); should be enough.

(In reply to Kershaw Chang [:kershaw] from comment #0)

task 2020-06-15T10:51:00.851Z] 10:51:00     INFO - GECKO(2778) | Assertion failure: XRE_IsParentProcess(), at /builds/worker/checkouts/gecko/ipc/glue/InputStreamUtils.cpp:272
[task 2020-06-15T10:51:00.855Z] 10:51:00     INFO -  Initializing stack-fixing for the first stack frame, this may take a while...
[task 2020-06-15T10:51:12.386Z] 10:51:12     INFO - GECKO(2778) | #01: nsBufferedInputStream::Deserialize(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [netwerk/base/nsBufferedStreams.cpp:649]
[task 2020-06-15T10:51:12.387Z] 10:51:12     INFO - GECKO(2778) | #02: mozilla::ipc::InputStreamHelper::DeserializeInputStream(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [ipc/glue/InputStreamUtils.cpp:357]
[task 2020-06-15T10:51:12.390Z] 10:51:12     INFO - GECKO(2778) | #03: nsMultiplexInputStream::Deserialize(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [xpcom/io/nsMultiplexInputStream.cpp:1026]
[task 2020-06-15T10:51:12.391Z] 10:51:12     INFO - GECKO(2778) | #04: mozilla::ipc::InputStreamHelper::DeserializeInputStream(mozilla::ipc::InputStreamParams const&, nsTArray<mozilla::ipc::FileDescriptor> const&) [ipc/glue/InputStreamUtils.cpp:357]
[task 2020-06-15T10:51:12.391Z] 10:51:12     INFO - GECKO(2778) | #05: mozilla::ipc::DeserializeIPCStream(mozilla::ipc::IPCStream const&) [ipc/glue/IPCStreamUtils.cpp:295]
[task 2020-06-15T10:51:12.392Z] 10:51:12     INFO - GECKO(2778) | #06: mozilla::ipc::DeserializeIPCStream(mozilla::Maybe<mozilla::ipc::IPCStream> const&) [ipc/glue/IPCStreamUtils.cpp:303]
[task 2020-06-15T10:51:12.392Z] 10:51:12     INFO - GECKO(2778) | #07: mozilla::net::HttpTransactionChild::RecvInit(unsigned int const&, mozilla::net::HttpConnectionInfoCloneArgs const&, mozilla::net::nsHttpRequestHead const&, mozilla::Maybe<mozilla::ipc::IPCStream> const&, unsigned long const&, bool const&, unsigned long const&, unsigned char const&, unsigned long const&, unsigned int const&, unsigned int const&, bool const&, unsigned long const&, bool const&, mozilla::Maybe<mozilla::net::H2PushedStreamArg> const&, mozilla::Maybe<mozilla::net::PInputChannelThrottleQueueChild*> const&, bool const&) [netwerk/protocol/http/HttpTransactionChild.cpp:180]
[task 2020-06-15T10:51:12.393Z] 10:51:12     INFO - GECKO(2778) | #08: mozilla::net::PHttpTransactionChild::OnMessageReceived(IPC::Message const&) [s3:gecko-generated-sources-l1:a6265be9f362522a0e665e06fbb23e4d45a0975a57788b56660e854fe5b47708d1552548e55ce3796dad85e88bf18f6b31b0b40bd50f629c8e72fac919b8706d/ipc/ipdl/PHttpTransactionChild.cpp::567]

I think change this assertion to MOZ_ASSERT(XRE_IsParentProcess() || XRE_IsSocketProcess()); should be enough.

Well, it's not that simple. IPCBlobInputStream can not be deserialized.

I would like to understand what the problem is before changing the inputStream serialization/deserialization.
Can you tell me more about why this crash happens?

Flags: needinfo?(kershaw)

To contextualize more why I think the bug is elsewhere, IPCBlobInputStream works as described here: https://searchfox.org/mozilla-central/rev/37932bfc600f97ec923464086dc12cdaa72aefde/dom/file/ipc/IPCBlobUtils.h#14

If the content process receives a IPCBlobInputStreamParams, there is something fundamentally wrong in the serialization of the stream. It would be great if we can reproduce this crash locally.

(In reply to Andrea Marchesini [:baku] from comment #4)

To contextualize more why I think the bug is elsewhere, IPCBlobInputStream works as described here: https://searchfox.org/mozilla-central/rev/37932bfc600f97ec923464086dc12cdaa72aefde/dom/file/ipc/IPCBlobUtils.h#14

If the content process receives a IPCBlobInputStreamParams, there is something fundamentally wrong in the serialization of the stream. It would be great if we can reproduce this crash locally.

Actually, this bug is about to deserializing IPCBlobInputStream in socket process, not content process.
In details, I am trying to serialize the stream in parent process here and deserialize it back in socket process at here.

To reproduce this locally, just run the following command. The crashed process is socket process.

./mach mochitest --headless --setpref="network.http.network_access_on_socket_process.enabled=true" toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js 
Flags: needinfo?(kershaw)

To reproduce this locally, just run the following command. The crashed process is socket process.

./mach mochitest --headless --setpref="network.http.network_access_on_socket_process.enabled=true" toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js 

Thanks for sharing this. IPCBlobInputStream is a complex object that doesn't send the real data to the content process, but, instead, it sends just and ID. The underlying inputStream is kept on the parent process and it shared only at the first nsIAsyncInputStream::asyncWait() call.
But all of this is not supported by SocketProcess yet.

I wrote a quick patch that passes the test adding the support for SocketProcess in the IPCBlobInputStream world.
Let me know if you want to use my patch and complete this bug, or you want me to take this bug.

Attached patch patchSplinter Review
Flags: needinfo?(kershaw)

(In reply to Andrea Marchesini [:baku] from comment #6)

To reproduce this locally, just run the following command. The crashed process is socket process.

./mach mochitest --headless --setpref="network.http.network_access_on_socket_process.enabled=true" toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js 

Thanks for sharing this. IPCBlobInputStream is a complex object that doesn't send the real data to the content process, but, instead, it sends just and ID. The underlying inputStream is kept on the parent process and it shared only at the first nsIAsyncInputStream::asyncWait() call.
But all of this is not supported by SocketProcess yet.

I wrote a quick patch that passes the test adding the support for SocketProcess in the IPCBlobInputStream world.
Let me know if you want to use my patch and complete this bug, or you want me to take this bug.

Thank you, baku! I think your patch should be the right approach. I've verified you patch is working locally and also on try.
It'd be great if you can take this bug, since I am not familiar with IPCBlobInputStream at all.

Flags: needinfo?(kershaw)
Attachment #9156978 - Attachment is obsolete: true

I wonder how many other issues there might be with this stuff. Needs quite some testing, I think

Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a6de6ce387db
IPCBlobInputStream for socket process, r=smaug,kershaw
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
You need to log in before you can comment on or make changes to this bug.