Skip to main content

Bug Tracker

Side navigation

#11243 closed bug (invalid)

Opened January 27, 2012 09:57AM UTC

Closed February 07, 2012 09:41PM UTC

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:
Description

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.

Attachments (0)
Change History (8)

Changed January 27, 2012 10:13AM UTC by CrazyChoco comment:1

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.

Changed January 30, 2012 10:43AM UTC by CrazyChoco comment:2

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.

Changed February 02, 2012 11:16AM UTC by CrazyChoco comment:3

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.

Changed February 02, 2012 09:17PM UTC by anonymous comment:4

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.

http://jsfiddle.net/8gPwU/9/

Changed February 03, 2012 10:07PM UTC by jw56578@gmail.com comment:5

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

Changed February 04, 2012 03:03PM UTC by dmethvin comment:6

owner: → 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.

Changed February 06, 2012 11:53AM UTC by CrazyChoco comment:7

_comment0: 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 find some sort of work-around, as ugly as that may be :(1328530629472972
_comment1: 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 :(1328530812963421
_comment2: 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 :( \ \ \ *Edit* \ \ I've been using code with the following format as a work-around: http://jsfiddle.net/8gPwU/10/ \ It's a bit of a hack and only masks the problem, but may have to do.1328607404967198
_comment3: 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 :( \ \ \ *Edit* \ \ 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.1328607458801670
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 :(

*Edit*

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 experiencing just in case it was happening to anyone else.

Changed February 07, 2012 09:41PM UTC by dmethvin comment:8

resolution: → invalid
status: newclosed

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