37

I have an ajax POST request that can take anywhere between 2 seconds to 30+ minutes. The post request occurs as a result of button click

If the request takes less than a minute or two, it comes back with a response and everything works fine. However if the request takes longer than two minutes it comes back with "Network error: XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff".

Ofcourse, it works fine Firefox and Chrome.

The application is deployed on a JBoss server with SSL enabled. The architecture here is that we have a load balancer that routes the request to two Jboss servers.

Internet Explorer

Version: 11.0.9600.180971C Update: 11.0.25

I have tried the following but in vain

1) ajax set cache to false - did not work

2) Changed registry settings as per https://support.microsoft.com/en-us/kb/813827 - did not work, here is where it gets confusing, thissuggests it is not an IE thing, but at the same time this works on chrome and ff so its not a server thing too

3) Set ajax timeout to 0 - did not work 4) Added e.preventDefault after $('#mdlSgn').click(function() { as per jQuery Ajax requests are getting cancelled without being sent

$('#mdlSgn').click(function() {
    $('#cnfdsgl').modal('hide');

     $.ajax({
        url: ajaxUrl,
        type: "POST",
        data: JSON.stringify(input),
        contentType: "application/json; charset=UTF-8",
        dataType: "json",
        success: function(data) {
             /// some logic


        },
        error : function(jqXhr, textStatus, errorThrown) {
            /// some logic
        }
    });

 //some other logic
}); 
Community
  • 1
  • 1
Nikhil Das Nomula
  • 1,863
  • 5
  • 31
  • 50
  • Yea I know it takes 30 minutes and the users are fine with it, they want to see a success response after that – Nikhil Das Nomula Dec 02 '15 at 18:26
  • 2
    You've got some understanding users. If it were me, I'd have the server respond immediately, put the task in a work queue, and then notify when the thing is done and the results are available. – Pointy Dec 02 '15 at 18:28
  • Well thats one way to do it, but the thing is that it was working fine before and I wanted to know the root cause of why IE behaves like that? – Nikhil Das Nomula Dec 02 '15 at 20:07
  • Why not do the processing not as part of the original request (which to call processing asynchronously and return immediately), but instead to have some kind of status/state request, that you can call on regular intervals to check if the processing has finished? – Zlatin Zlatev Dec 11 '15 at 11:58

3 Answers3

21

We spend multiple days searching for the cause of this problem!

  • In the console: SCRIPT7002: XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff.
  • In the network tab of IE/Edge, we see the failed request as 'Pending...'
  • XmlHTTPRequest/JQuery returns 404 error at the client, but the server returned a successfully 200 response.
  • No response headers returned

We only had this problem when using all of these:

  • HTTP/2
  • POST requests
  • Windows 10
  • IE or Edge

Apparently it is a Windows 10 bug in the HTTP stack that is now solved in Windows 10 version 1803 (April 2018). So normally this problem will disappear over time for people/companies using auto updates of Windows. used Windows 10 versions WorldWide

We tested this on an older and newer version of Windows 10 and it is indeed solved.

Some temporary solution could be:

  • disable HTTP/2 for IE and Edge and use HTTPS (server side change).
  • use GET (if possible)
  • does PUT also has this problem?
  • do some retries if no response headers are returned
  • accept that IE/Edge users will be punished ;-)
Jo VdB
  • 2,016
  • 18
  • 16
7

can take anywhere between 2 seconds to 30+ minutes

I assume this is because of large amount of data to transfer.

I have creating large file uploader, that handles 20GB+ video files and may last for several hours.

In my experience - uploading large data with single ajax request can cause strange browser crashes (for example my Chrome browser crashes in about 20% of upload tests).

The most reliable way, what I found, is to split data in chunks of 1MB and send them sequentially to the server by separate ajax requests.

ujeenator
  • 26,384
  • 2
  • 23
  • 28
  • I can describe detailed example, if you need it. – ujeenator Dec 09 '15 at 20:43
  • Thank you for the answer Amber, however this is not for file uploads, it is the backend process that takes that much time... – Nikhil Das Nomula Dec 10 '15 at 16:14
  • 2
    @user1707141 I found workaround for error code which you mentioned, try it: "Open up Internet Options, choose the Advanced tab, and then click the "Restore Advanced Settings" button. After that the Ajax requests worked fine." – ujeenator Dec 10 '15 at 17:32
  • 2
    The IE settings in our company are determined by the System Admin and hence I do not have much flexibility in that.. – Nikhil Das Nomula Dec 11 '15 at 14:09
  • can you provide me with the code for the large file upload? im facing the same issue for a control i did for drag and drop uploading using jquery.filedrop.js and mvc – ChathuraSam Aug 03 '17 at 04:50
  • @ChathuraSam, sure, but I need some time to prepare it. I think I will publish it on saturday. – ujeenator Aug 03 '17 at 11:38
  • @Ujeenator Thanks a lot. that will not be a problem :) Please provide me with the link when you do. :) – ChathuraSam Aug 03 '17 at 12:30
1

In my case it was custom response code (3020) returned from server. Switched it to 200 and modified SPA client logics, this solved the issue.

aleha_84
  • 8,309
  • 2
  • 38
  • 46
  • Same with me. I returned 302 and old IE did not like it. Switching to 200 did solve the problem. – cskwg Jan 17 '22 at 19:06