Closed Bug 1381465 Opened 7 years ago Closed 7 years ago

IPCBlobInputStream should preserve the non-blocking flag of the remote inputStream

Categories

(Core :: DOM: File, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1397627

People

(Reporter: baku, Assigned: baku)

Details

Attachments

(2 files)

Currently IPCBlobInputStream is always non-blocking.
Attached patch blocking.patchSplinter Review
Attachment #8887026 - Flags: review?(bugs)
Comment on attachment 8887026 [details] [diff] [review]
blocking.patch

Could you explain this bug. Do we have some actual issues without this patch? If so, do we need to fix this on all the branches? If not, why not?
Attachment #8887026 - Flags: review?(bugs)
Comment on attachment 8887026 [details] [diff] [review]
blocking.patch

Think about a remote file: a DOM file selected from a FilePicker in the parent process and sent to the content process. Its inputStream is a nsFileStream, blocking for I/O.

When we use FileReader on the content process, we move that inputStream to the content process, moving the internal file descriptor. We must preserve the fact that this stream is blocking, otherwise FileReader will do I/O on the main-thread.
Attachment #8887026 - Flags: review?(bugs)
And do we need the patch on branches? What is the actual bug this is fixing? I mean, is this fixing some issue a Firefox user can see today?
I'm puzzled why using File objects in child process isn't all broken without this.
> And do we need the patch on branches? What is the actual bug this is fixing?
> I mean, is this fixing some issue a Firefox user can see today?

Everywhere IPCBlob is landed. I/O on main-thread when FileReader is used is bad, but it doesn't break firefox.
Could we still explain. What causes main thread I/O currently, and on which processes does that happen?
Attachment #8887026 - Flags: review?(bugs) → review+
Is there anything remaining blocking this from being landed? 
uplifting bug 1377589 to beta 55 depends on this according to bug 1377589 comment 16.
Flags: needinfo?(amarchesini)
I discussed this with smaug and overholt. I need to have necko able to work correctly with a nsIAsyncInputStream. Currently Necko uses ::Available() to know the size of the inputStream, mainly for the Content-Length header. This happens in several places. I have to fix that, and then I can land this patch.
Flags: needinfo?(amarchesini)
(In reply to Andrea Marchesini [:baku] from comment #8)
> I discussed this with smaug and overholt. I need to have necko able to work
> correctly with a nsIAsyncInputStream. Currently Necko uses ::Available() to
> know the size of the inputStream, mainly for the Content-Length header. This
> happens in several places. I have to fix that, and then I can land this
> patch.

:baku, thanks for much for explaining again here that helped me a lot. :)
Shouldn't this be a qf bug, even qf:p1. Comment 3 is very worrisome.
Flags: needinfo?(amarchesini)
Whiteboard: [qf]
We're definitely reading files on the main thread in the content process right now (probably due to this bug). It's showing up with a fairly high frequency in BHR.

I've attached a screenshot (as linking into hangs.html is unstable right now).

:asuth mentioned that the appearance of SlicedInputStream here might add another wrinkle.
Whiteboard: [qf] → [qf][bhr]
This bug is 'already' fixed, but the patch cannot land because necko doesn't support fully nsIAsyncInputStreams yet.
There are several places where necko uses Available() to retrieve the size of the stream and, of course, this doesn't work if the stream is async.

I have a couple of patches for fixing this issue and they are almost green except for a SW test in e10s.
I hoping to finish these patches for this week.
Flags: needinfo?(amarchesini)
Depends on: 1377589
Whiteboard: [qf][bhr] → [qf:p1][bhr]
I'll work on this in bug 1397627. Patches are ready.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Whiteboard: [qf:p1][bhr]
No longer depends on: 1377589
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: