Bug Tracker

Opened 5 years ago

Closed 5 years ago

#11243 closed bug (invalid)

AJAX requests (e.g. calling $.get() or $.ajax()) sometimes fail without calling any of the callback functions

Reported by: CrazyChoco Owned by: CrazyChoco
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


Hello there

We usually like to be quite bleeding edge when it comes to jQuery releases, and we've been trying out jQuery version 1.7.1 for just over a month now for our AJAX-based applications.

Unfortunately we are occasionally seeing a problem when using jQuery to launch AJAX requests.

Occasionally a request will fail for some reason (which may be legitimate, e.g. due to a network issue or timeout). However sometimes jQuery will then not call the "success" function it was passed, *and* not call the error handler function registered by $.ajaxSetup(). This effectively causes an AJAX-based application to "stall", as without the success function or the error-handler being called to let it know that it can continue, it just sits there waiting.

This event seems very rare (definitely less that one time in 100) but can be reproduced eventually by sitting down and using an application for long enough. By adding debug information we have narrowed the problem down to the calls to $.get() and $.ajax(), and are reasonably confident that it is a problem with the error handlers not being called.

Nobody can remember these problems happening in jQuery 1.6.4, so we suspect it may be a reasonably recent problem.

Change History (8)

comment:1 Changed 5 years ago by CrazyChoco

If you look at http://jsfiddle.net/8gPwU/1/ you'll see the basic form of the code that is causing a problem (though you may need to try an actual URL rather than just a '/').

I would expect that at one of the alert messages (either the success or the error) be displayed, but very rarely the code will run without displaying either alert.

comment:2 Changed 5 years ago by CrazyChoco

Unfortunately we've now managed to reproduce the problem in 1.6.4 which means it's probably not something new in 1.7.1; I apologise for misleading anyone as to the version in my original message.

I'm still pulling my hair out either trying to work out what is causing this or at least to get a work-around. However I've got very few clues to go on and the fact that it happens infrequently makes experimentation difficult to do.

I'll add another comment if I get any further or find out any more.

comment:3 Changed 5 years ago by CrazyChoco

I thought that perhaps using the deprecated functions might be causing a problem, so I rewrote my code using the new callbacks.

My jQuery calls now follow the format here: http://jsfiddle.net/8gPwU/5/

Unfortunately this has not helped and the problem seems the same as it was: most of the time the callback functions work as expected, but very rarely they fail without calling any of the callbacks.

comment:4 Changed 5 years ago by anonymous

FYI I've tried reproducing this using the following jsiddle and can't. Up to a maximum of 200 requests, and it still works as expected.


comment:5 Changed 5 years ago by jw56578@…

I am experiencing the same issue. I make the same request over and over and it randomly fails. Looking in chrome network tab it shows, Cookies are not sent in the request and the Request Method is not specified.

MYURL GET (canceled) undefined jquery-1.7.js:8157 Script 13B 0B 19.10s 0.0 days

comment:6 Changed 5 years ago by dmethvin

Owner: set to CrazyChoco
Status: newpending

We still need a test case in order to investigate this. So far the report doesn't even indicate whether this occurs in all browsers or just one. Please reply on the ticket only when you have a test case.

comment:7 Changed 5 years ago by CrazyChoco

Status: pendingnew

Hi there everyone, thank you very much for giving this some of your time; it's very much appreciated.

@ anonymous

I've had a look at your code. It probably wasn't a fair test without an actual a URL or a cache-killer, but I saw where you were going.

I've spent a good deal of time this morning trying to reproduce the bug using your looping approach, only without any luck. But that's still quite helpful; it seems to point towards there being some sort of rare initialisation problem, more than something can be reproduced with a loop.

@ dmethvin

Ah, I apologise, I should have mentioned that we were predominantly testing in Firefox. We're on the latest stable version (which was 9.0.1 when we opened the ticket, but we've since moved on to version 10.0).

I wish the nature of the problem allowed me to give you a better test case. If you look at http://dev-ct.tribiq.com/ajax_test/index.html and http://dev-ct.tribiq.com/ajax_test/index2.html you can see my best attempts to try and reproduce the issue on-demand. However it's difficult to pin down; I've yet to be able to reproduce this at will, and it usually crops up only about once or twice a day for us, and usually when we're working on something else.

Do you think it could be a browser issue? It may be time to for me to drop this and use a work-around, as ugly as that may be :(


We're going to be going forward with a work-around that repeatedly calls the jQuery command every 5 seconds until we get a response, which is usually on the first attempt, but if jQuery ever does "stall" like this then it means that 5 seconds later the application will continue as normal.

It's a bit of a hack but it will have to do unfortunately :(

Thank you for everyone who helped out. If this was in fact a browser issue and not related to jQuery itself then please let me apologise; however I did feel the need to try and be helpful and share the issue I was happening just in case it was happening to anyone else.

Version 3, edited 5 years ago by CrazyChoco (previous) (next) (diff)

comment:8 Changed 5 years ago by dmethvin

Resolution: invalid
Status: newclosed

If you can isolate the problem please do create a new ticket with a specific test case.

Note: See TracTickets for help on using tickets.