Closed Bug 315767 Opened 19 years ago Closed 18 years ago

Submission of large files using multipart-post doesn't work

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jhpedemonte, Assigned: jhpedemonte)

References

()

Details

(Keywords: fixed1.8.0.4, fixed1.8.1)

Attachments

(3 files, 1 obsolete file)

The testcase (https://bugzilla.mozilla.org/attachment.cgi?id=197763) fails when trying to submit a large file.  For me, it works fine when attaching a file with size 28K.  But when trying to submit a file of size 100K, I see the appropriate network messages on the status bar (that it is communicating with the destination server), but the echo.sh page never loads.
(In reply to comment #0)
> The testcase (https://bugzilla.mozilla.org/attachment.cgi?id=197763) fails when
> trying to submit a large file.  For me, it works fine when attaching a file
> with size 28K.  But when trying to submit a file of size 100K, I see the
> appropriate network messages on the status bar (that it is communicating with
> the destination server), but the echo.sh page never loads.
> 

Stupid question: It's not just a limit on echo.sh? (I haven't tested myself)
Doesn't seem to be a problem with the server.  We created an HTML testcase, using HTML file submission, and that one worked fine.  Debugging a little more, it looks like the file input stream is returning NS_BASE_STREAM_WOULD_BLOCK at some point.  No idea why, yet.

CCing Darin, since he wrote some of the submission code and might be able to help.
Blocks: 326372
Blocks: 326373
So we get status == NS_BASE_STREAM_WOULD_BLOCK in nsXFormsSubmissionElement::OnStopRequest(), which is called because we set the notification callbacks to this class object at the bottom of nsXFormsSubmissionElement::SendData().  The listener is set as the output end of an nsIPipe, whose docs explain that a non-blocking stream will return NS_BASE_STREAM_WOULD_BLOCK if more input can't be read without blocking the thread.

Creating the pipe with the output set to blocking won't work, since this blocks the thread indefinitely.  Reading the nsIPipe docs, I'm guessing that we need to use an nsIAsyncOutputStream, and use AsyncWait to get the remainder of the data.
Attached file http log - failure
Log of HTTP submit and response, using large file (~150K).  As you can see, response is cut off.
NSPR log of Http:5 of same failure case.
Attached patch v1 patch (obsolete) — Splinter Review
This should work.  The problem is that we were passing 0 for the segmentSize of the pipe, which causes the pipe to use its default configuration, ignoring the value of maxSize passed to it.  The real fix to this bug is to change NS_NewPipe to honor maxSize even when segmentSize is 0.
Comment on attachment 214573 [details] [diff] [review]
v1 patch

Sweet, works for me.

However, I did notice that the throbber was not doing its thing when awaiting the response.  Since I am testing with a large file, it took a while to submit and get the response.  But the only indication that any waiting was taking place came from looking at the status bar.  It would be nice if the throbber also showed progress.
Attachment #214573 - Flags: review+
Hmm.. not sure why the throbber wouldn't spin.  If the progress bar is moving, then the throbber should as well.  That's really odd.
Sorry, should have been more specific.  There is no progress bar, but I do see the "Transferring from..." text in the status bar.
Ah, ok.  That still seems wierd.  Afterall, we hook up the document's loadgroup to the channel used for submission, and that should be sufficient to drive the proper progress notifications.
I believe we only do the throbber/progress bar stuff if we have a channel with LOAD_DOCUMENT_URI In the loadgroup, or something like that...
Attached patch patch v2Splinter Review
Sweet!  Adding the LOAD_DOCUMENT_URI flag made the throbber work.  Here's that patch, with Darin's fix.
Attachment #214573 - Attachment is obsolete: true
Attachment #214679 - Flags: review?(darin)
Attachment #214679 - Flags: review?(darin) → review+
Attachment #214679 - Flags: review?(aaronr)
Attachment #214679 - Flags: review?(aaronr) → review+
Checked in to trunk. -> FIXED

Darin, did you already open a bug for the NS_NewPipe issue?
No, I did not.  If you can do that, I'd appreciate it.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Blocks: 332853
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: