Open Bug 1438505 Opened 7 years ago Updated 2 years ago

Ajax calls aborted when loading same domain in another tab

Categories

(Core :: Networking: HTTP, defect, P3)

58 Branch
defect

Tracking

()

Tracking Status
firefox58 --- affected
firefox59 --- affected
firefox60 --- affected

People

(Reporter: camilobenito, Unassigned)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

206.82 KB, application/x-bzip
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 Steps to reproduce: 1. Open 2 firefox windows with google drive 2. On window1, start uploading a large file. Google drive will launch an ajax call for this upload 3. During the upload process in window1, go to window2 and refresh google drive 4. Go back to window1 and the HTTP request will be suddenly aborted. Google drive will automatically restart the upload but every time you refresh window2 the HTTP request will fail The problem seems to be when you have 2 windows using the same domain. I have tested this with: - Google drive - GMail - VirusTotal Actual results: Ajax HTTP request fails with status "error" but no other error message. Expected results: Navigating on another window, even if it's under the same domain as another window, should not cause that Ajax requests are aborted.
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13; rv:58.0)Gecko/20100101 Firefox/58.0 I was able to reproduce this issue with Google drive on Mac OS X 10.13 using the above steps with latest Nightly, Beta and Firefox Release builds. When refresh is triggered on the second window the upload in the first window gets restarted.
Component: Untriaged → Networking: HTTP
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Michal, do you have time to look into this?
Flags: needinfo?(michal.novotny)
Attached file log
All I can see in the log is that the connection is reset by the peer: 2018-02-22 16:07:22.498235 UTC - [28658:Socket Thread]: I/nsHttp Http2Stream::TransmitFrame for inline BufferOutput session=0x7fd88c3ef000 stream=0x7fd88e831be0 result 0 len=25 2018-02-22 16:07:22.498237 UTC - [28658:Socket Thread]: V/nsHttp Http2Session::LogIO 0x7fd88c3ef000 stream=0x7fd88e831be0 id=0x17 [Writing from Inline Buffer] 2018-02-22 16:07:22.498241 UTC - [28658:Socket Thread]: V/nsHttp 00000000: 00 00 10 00 00 00 00 00 17 28 64 03 DF A5 D4 C6 2018-02-22 16:07:22.498244 UTC - [28658:Socket Thread]: V/nsHttp 00000010: C9 B8 91 5A 96 B6 26 67 A1 2018-02-22 16:07:22.498246 UTC - [28658:Socket Thread]: D/nsSocketTransport nsSocketOutputStream::Write [this=0x7fd886583690 count=25] 2018-02-22 16:07:22.498248 UTC - [28658:Socket Thread]: D/nsSocketTransport calling PR_Write [count=25] 2018-02-22 16:07:22.498259 UTC - [28658:Socket Thread]: D/nsSocketTransport PR_Write returned [n=-1] 2018-02-22 16:07:22.498262 UTC - [28658:Socket Thread]: D/nsSocketTransport ErrorAccordingToNSPR [in=-5961 out=804b0014] But it's interesting that I was not able to reproduce the problem when I turned HTTP/2 off. Maybe this scenario mess somehow Http2Session up and the server closes the connection. Nick, could you have a look at it?
Flags: needinfo?(michal.novotny) → needinfo?(hurley)
Hi all. Thanks for the debugging done to track this. Is there any fix for this? Thank you
Priority: -- → P3
Whiteboard: [necko-triaged]
Increasing priority to P2 because this might be potentially bug in our HTTP/2 implementation. Nick, please verify that it's actually a server side bug. I don't think anybody else knows HTTP/2 good enough to do it.
Assignee: nobody → hurley
Priority: P3 → P2
I was able to reproduce this a while back, but am now unable to reproduce - loads/reloads of the same domain in a second tab do not stop uploads (on google drive). This seems to indicate to me that this is a google-side issue that has since been fixed. Reporter, can you still reproduce?
Assignee: hurley → nobody
Flags: needinfo?(hurley) → needinfo?(camilobenito)
Priority: P2 → P3
Hello, Yes, I have been able to reproduce this right now with Firefox 59.0.2. I indicated Google Drive because it's a site that anyone can have access to test and reproduce this easily, but I found out this issue while I was programming with Javascript a tool which uploads files via Ajax. You can do these 2 tests which will quickly reproduce the issue: 1. Open 2 Google Drive windows. Start upload on one window, go to the other window and refresh and then go back to the uploading window. This last step is important. Once you set the focus back on the uploading window the upload will fail and you will see the GDrive progress circle go back to the beginning. 2. Make a Javascript file which uploads via ajax to any site. Then while the script is uploading, open another window in that same domain and then set the focus back to the window with the Javascript upload. If you need more info let me know and I will be happy to help.
Flags: needinfo?(camilobenito)
Flags: needinfo?(hurley)
(In reply to camilobenito from comment #7) > Yes, I have been able to reproduce this right now with Firefox 59.0.2. I > indicated Google Drive because it's a site that anyone can have access to > test and reproduce this easily, but I found out this issue while I was > programming with Javascript a tool which uploads files via Ajax. I can reproduce the problem on google drive too. Can you please try to reproduce the problem with HTTP/2 disabled to confirm that it's HTTP/2 related? Set network.http.spdy.enabled.http2 to false in about:config. > 2. Make a Javascript file which uploads via ajax to any site. Then while the > script is uploading, open another window in that same domain and then set > the focus back to the window with the Javascript upload. I tried to reproduce the problem locally, but it didn't work. I used upload code from https://github.com/New-Bamboo/example-ajax-upload/blob/master/public/index.html and I sent the data a to simple cgi script that just consumed the incoming data. It would help if you could provide a minimalistic test that we could use locally.
Flags: needinfo?(camilobenito)
I have tried with HTTP2 disabled and it works correctly, therefore it seems the issue is indeed HTTP2 related. I'll try to prepare a simple script tomorrow for you to try locally. It's basically an Ajax call with dataType 'binary': $.ajax({ url: requestUrl, method: requestMethod, xhrFields: { withCredentials: true, }, dataType: 'binary', data: params, success: function(request) { }, error: function() { }, }); I use the following transport for binary data type: $.ajaxTransport('+binary', function(options, originalOptions, jqXHR) { // check for conditions and support for blob / arraybuffer response type if (window.FormData && ((options.dataType && (options.dataType == 'binary')) || (options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) || (window.Blob && options.data instanceof Blob)))) ) { return { // create new XMLHttpRequest send: function(headers, callback) { // setup all variables let xhr = new XMLHttpRequest(); let url = options.url; let type = options.type; let async = options.async || true; // blob or arraybuffer. Default is blob let dataType = options.responseType || 'blob'; let data = options.data || null; let username = options.username || null; let password = options.password || null; xhr.addEventListener('load', function() { let data = {}; data[options.dataType] = xhr.response; // make callback and send data callback(xhr.status , xhr.statusText , data , xhr.getAllResponseHeaders()); }); xhr.open(type, url, async, username, password); // setup custom headers for (let i in headers) { xhr.setRequestHeader(i, headers[i]); } xhr.responseType = dataType; xhr.send(data); }, abort: function() { jqXHR.abort(); }, }; } });
Flags: needinfo?(camilobenito)
camilobenito, if you get to it, could you please try to reproduce with following preferences turned to "false", each one separately (they are independent technologies): "network.http.throttle.enable" "network.http.active_tab_priority" You'll find them on about:config page. Thanks.
Hello Honza, I have tried with those 2 settings to false (individually) but the issue is still there. With network.http.active_tab_priority to false the behaviour is very strange. Uploads are very slow and they take a long time to start.
Hello all, Do we have any updates on this? If you need any other tests from my part please let me know. Thank you!
You mentioned in comment #9 that you'll prepare a test. Can you please do it? My JS knowledge isn't good enough to write a test according to information you provided in comment #9.
Flags: needinfo?(camilobenito)
Severity: normal → S3

Clear needinfos that are pending on inactive users.

Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE.

For more information, please visit BugBot documentation.

Flags: needinfo?(u408661)
Flags: needinfo?(camilobenito)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: