Opened 12 years ago

Closed 11 years ago

#6909 closed defect (fixed)

xhrGet connections leak in IE7 (but not IE6!)

Reported by: guest Owned by: James Burke
Priority: high Milestone: 1.2
Component: General Version: 1.1.1
Keywords: Cc: martay@…
Blocked By: Blocking:

Description

I wrote a pretty small test case, and posted in the forum. Load this up in IE7 (I included a link below if you want to try it real quick) and hit reload twice. It should freeze. Here's what I posted in the forum:

Here's the sample code: <html> <head> <title>IE7 Connection Leaking test</title> <script type="text/javascript" src="dojo.js"></script> <script type="text/javascript"> function updateChat() {

updateChatCon = dojo.xhrGet({

url: "sleep.php"

});

}

function init() {

updateChat();

} </script> </head> <body onload='updateChat()'> Load the page and then hit reload twice. On IE7, the connection will hang (sometimes it will come back after a while). </body> </html>

You can run it here: http://dojobug.innavenir.com

The php being called can be viewed here: http://dojobug.innavenir.com/sleep.php.html

My version of IE7 is 7.0.5730.13

Please tell me I'm doing something stupid!

Thanks!

Change History (8)

comment:1 Changed 12 years ago by James Burke

I believe the issue is using body onload="updateChat()". By manually overriding onload, you may be interfering with Dojo's page load detection, which also then registers a cleanup function for page unload for IE (if my memory is correct).

Try doing

dojo.addOnLoad(function(){
    updateChat();
});

in the script block after the updateChat function definition and remove the body onload attribute.

comment:2 Changed 12 years ago by guest

Thanks for the suggestion, but I'm still seeing the same behavior: http://dojobug.innavenir.com/index2.html

(as seen here for visitors of the far future): <html> <head> <title>IE7 Connection Leaking test</title> <script type="text/javascript" src="dojo.js"></script> <script type="text/javascript"> function updateChat() {

updateChatCon = dojo.xhrGet({

url: "sleep.php"

});

}

dojo.addOnLoad(function(){

updateChat();

}); </script> </head> <body> Load the page and then hit reload twice. On IE7, the connection will hang (sometimes it will come back after a while). </body> </html>

I was able to test this on 2 computers now and see the same behavior with IE7.

comment:3 Changed 12 years ago by James Burke

OK, this could be related to an issue where the dojo.addOnUnload callbacks were not being fired when the page unloaded. This should be fixed in the trunk code (available via subversion, or go to http://archive.dojotoolkit.org/nightly/

Can you try the nightly build to see if the addOnUnload bug fix fixes this issue?

comment:4 Changed 12 years ago by guest

I grabbed the latest from svn and built it with ./build.sh profile=standard action=release then copied release/dojo/dojo/dojo.js to dojodev.js.

But, I still see the same problem. See http://dojobug.innavenir.com/index2a.html Please sanity check me and see if you can reproduce the bug.

I'm of course biased, but I think this bug should have an elevated priority since this is a fairly critical issue and 100% reliably/easily reproducible.

comment:5 Changed 12 years ago by guest

Also, I tried mochikit and it exhibits the problem unless you explicitly cancel the deferred connection. Bugged: http://dojobug.innavenir.com/index3.html

Not bugged: http://dojobug.innavenir.com/index4.html

index4.html cancels the deferred connection onbeforeunload.

comment:6 Changed 11 years ago by dylan

Milestone: tbd

comment:7 Changed 11 years ago by James Burke

Milestone: tbd1.2
Owner: changed from anonymous to James Burke

OK, found the issue: in IE7, typeof xhr.abort is "object" not "function". Will fix for 1.2. Thanks for the bug report and test case!

comment:8 Changed 11 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [14297]) Fixes #6909: xhr calls were not being aborted onunload in IE7 since typeof xhr.abort is 'object' in that case, and not 'function'.

Note: See TracTickets for help on using tickets.