Closed Bug 1317725 Opened 8 years ago Closed 8 years ago

[e10s] Crash in mozilla::ipc::MessageChannel::AssertWorkerThread when sending file data in FormData through XHR in a worker

Categories

(Core :: DOM: Workers, defect)

50 Branch
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox50 - wontfix
firefox51 - fixed
firefox52 + fixed
firefox53 - fixed

People

(Reporter: cachius, Assigned: baku)

References

Details

(Keywords: crash, hang, testcase)

Crash Data

Attachments

(4 files)

Attached file fileworker.js
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

Steps to reproduce:

I use FormData inside a webworker to send files piece by piece via XHR.
The worker receives a File object via postMessage.
Then it creates a chunk using the File.slice() method,
appends it to a FormData instance and sends this via XHR.


Actual results:

Without e10s everything works fine.
With e10s enabled this suddenly doesn't work anymore, instead
Windows 7: the tab freezes, closable via 2(!) clicks on  its close button
MacOS: the whole browser freezes.


Expected results:

It should work with e10s enabled.
Attached file Testcase
Blocks: e10s
Component: Untriaged → DOM: Workers
Product: Firefox → Core
With e10s enabled.

Freezing should have been fixed by bug 1301094:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=d3303b1ac645d0b9def8dabd3e6a5f09aebd274c&tochange=cdc7be84b21a4092e04f1665e5eba5b31e54b63f

But FF50+ are crashing now with the testcase joined to the bug report.

FF51:
https://crash-stats.mozilla.com/report/index/5361c977-5ef7-4630-bc22-ade652161116
FF53:
https://crash-stats.mozilla.com/report/index/35705a81-5fa0-4995-9670-fd3b82161116
Blocks: 1301094
Severity: normal → critical
Status: UNCONFIRMED → NEW
Crash Signature: [@ mozilla::ipc::MessageChannel::AssertWorkerThread | mozilla::ipc::MessageChannel::Send | mozilla::ipc::PBackgroundChild::SendPBlobConstructor ] [@ mozilla::ipc::MessageChannel::AssertWorkerThread | mozilla::dom::BlobChild::SendSliceConstructor<T> ]
Ever confirmed: true
Flags: needinfo?(amarchesini)
Keywords: crash, hang, testcase
Summary: webworker: FormData/file access broken when e10s enabled → [e10s] Crash in mozilla::ipc::MessageChannel::AssertWorkerThread when sending file data in FormData through XHR in a worker
Version: 49 Branch → 50 Branch
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Some comments here:

1. the crash itself is fixed by using EnsureBlobForBackgroundManager() in Read/WriteFormData.

2. but then there is a new crash: how we manage sliced remove blob cross threads. We don't set mActorTarget in remoteBlob when they are generated from a slice, this means that when ::Destroy() is called, we crash. This happens because:
https://dxr.mozilla.org/mozilla-central/source/dom/ipc/Blob.cpp#2311

This returns true, bacause mEventTarget is nullptr.
  if (EventTargetIsOnCurrentThread(mActorTarget)) {
    if (mActor) {

This crash, because we are not on the worker thread.
      mActor->AssertIsOnOwningThread();

Solution is to initialiaze mEventTarget also for sliced blobs.
Attachment #8811208 - Flags: review?(bugs)
Attachment #8811208 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/959c8ce0a649
Correct creation of Sliced Remote Blob actorss when used in FormData in workers, r=smaug
https://hg.mozilla.org/mozilla-central/rev/959c8ce0a649
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Tracking 53- since this has been fixed.
Track 51- as the volume of the crash is low.

Hi :baku,
Is this worth uplifting to Beta51 and Aurora52?
Flags: needinfo?(amarchesini)
Comment on attachment 8811208 [details] [diff] [review]
blob_formData.patch

Approval Request Comment
[Feature/regressing bug #]: FormData + XHR + Worker
[User impact if declined]: FF crashes.
[Describe test coverage new/current, TreeHerder]: green on try. test included.
[Risks and why]: The patch is simple: we must create blob actors for each thread also when FormData is serialized. Somehow we forgot to do it for this cloned objected.
[String/UUID change made/needed]: none
Flags: needinfo?(amarchesini)
Attachment #8811208 - Flags: approval-mozilla-beta?
Attachment #8811208 - Flags: approval-mozilla-aurora?
Comment on attachment 8811208 [details] [diff] [review]
blob_formData.patch

Fix a crash. Beta51+ and Aurora52+. Should be in 51 beta 3.
Attachment #8811208 - Flags: approval-mozilla-beta?
Attachment #8811208 - Flags: approval-mozilla-beta+
Attachment #8811208 - Flags: approval-mozilla-aurora?
Attachment #8811208 - Flags: approval-mozilla-aurora+
has problems to uplift 

grafting 376698:5cac2e6569d0 "Bug 1317725 -Correct creation of Sliced Remote Blob actorss when used in FormData in workers, r=smaug, a=gchang"
merging dom/base/StructuredCloneHolder.cpp
merging dom/ipc/Blob.cpp
merging dom/workers/test/mochitest.ini
merging dom/workers/test/script_bug1301094.js and dom/workers/test/script_createFile.js to dom/workers/test/script_createFile.js
warning: conflicts while merging dom/workers/test/mochitest.ini! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
Flags: needinfo?(amarchesini)
Attached file m-b
Flags: needinfo?(amarchesini)
Hi :Tomcat,
Per comment #13, can you help uplift the new patch to beta?
Flags: needinfo?(cbook)
Flags: needinfo?(cbook)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: