Today is a good day to code

Internet Explorer 6 Hangs with Multiple Connections

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, JavaScript, Programming, Uncategorized | Tags: , , , | 6 Comments »

Internet Explorer 6 Hangs with Multiple Connections

At work we are using the demis map server, which by itself is an incredible application. We had built a flash based client as our application to allow people to see images overlaid on top of the vector data digested by the map server. One of the issues we had observed with the application was that it tended to hang, or stop responding when a user would ask for many images to be shown on top of the vector map, then they navigated away from the current screen. Now, since I had seen the code and it was a mess with JavaScript setting cookies that ColdFusion was supposed to read and pass to flash, and images for checkboxes, I automatically suspected the code. However, the problem was deeper than that.

The code needs to be rewritten no doubt, there are many more efficiencies to be had, but that didn’t explain the hang. I combed over the server, watching response while a user was using the application. The map server stresses the machine, because it needs a ton of I/O and it would spike the CPU frequently, but no processes went to 99% CPU utilization, and the server seemed to respond to other clients even when one of them was hung up. It was pretty clear then that the problem wasn’t with the server. To take this logic a little further, we built a load test using wget and saving the result to a file. We looped over the calls as fast as we could and we never caused the map server to hang. It performed as expected.

The next logical step was to look at the possibility of corrupt files. We did notice that we could get the map server to crash when we fed it corrupt files, but we found no eveidence that the files that we were using in production were corrupt in any way. At this point we were plenty dejected, because we had spent something like 35 hours over a couple days working on this problem and we had nothing. We performed a new ColdFusion install on a different server, we built a server with better hardware, we reinstalled the map server application multiple times, nothing seemed to affect it. We even improved the network bandwidth available to the client, still nothing. At that point I was down to either it was the code, or it was the client.

To test this theory I commented out all of the flash calls on every page and went through the application to try to cause the system to hang. I couldn’t do it, so I had effectively limited the possible cause to the Flash movie. I started to go through what the Flash movie was doing, and what could cause it to fail. The demis people told us that they had seen hangs when the map server wasn’t responding, and the Flash player was parsing XML. This lead me to try the application in Firefox, and lo and behold, it never hung up. It worked like a charm. The only problem was that our client was set on Microsoft Internet Explorer

I started about the arduous task of removing all XML parsing from the Flash code, then I tried it and it still hung. I was truly disappointed, but I rethought what was happening with the XML. It was making server calls, I realized that I could have up to 8 consecutive connections going on. At the time I thought it was nothing, but then I started trying to find out what was different between Internet Explorer and Firefox. I happened upon an article on MSDN about a known bug that Internet Explorer will hang for 5 minutes when there are 2 persistent connections to a server, and rich content is downloaded. I had found my culprit. It turns out that I had to add 2 keys to the registry. MaxConnectionsPerServer, and MaxConnectionsPer1_0Server. I set the latter to 8 and the former to 24, hexadecimal. The keys need to be DWORD keys.

That would allow 8 connections for HTTP 1.0 and 32 or so connections for HTTP 1.1. The HTTP 1.1 guidelines recommend that there only be 2 connections allowed, but if Firefox wasn’t adhering to it, why should I. I added the keys to HKEY_CURRENT_USER>Software>Microsoft>Windows>Current Version>Internet Settings and it worked like a charm. Everything was perfect. Talk about looking for a needle-in-a-haystack. I’m still amazed that I found it.

The purpose of this entry is so that no one has to go through the week that I just went through. Generally no software should be in front of the client before it is ready, but in this case we already had a client. Hopefully this will help anyone out there who is experiencing hangs in Internet Explorer. Darn Microsoft and not fixing bugs for almost 3 years!

*EDIT Make that 8 years, since IE 8 appears to still suffer from the same problem!*

Here are some helpful links that might be better at explaining than I am…

Wininet Connection Issue

IE Hang Issue

  • Karl C

    Thanks dude! I have been suffering from this weird IE known bug for weeks!

  • Nico

    Dont use these settings in a big environment. You can easily flood a proxyserver having 500 users going from 2 connections to 8 or even 24.

    You posted a solution of the problem, but never got into the reason of the problem. Actualy, its not a solution, its a ‘workarround’ for damn ugly coding.

    The cause is that numerous connection to a proxy or nat router stay in time_wait.(pls look that up if you dont know what that means, time_wait is the time a connection needs to ‘die on the internet’ so that the port used for a TCP/IP stream isn’t reused by another application causing possible security threads). So, because the huge number of images to download by your javascript (generated by Coldfusion), to manny connections remain in time_wait, flooding your isa server or NAT router. Or even the webserver itself.

    The reason your IE looks like it is hanging is because it is waiting to re-use the connections in time_wait. This, to my knowledge only happens on https secured sites. Firefox somehow handles it differently. Even with the standard settings firefox rox on.

    IMO, the real solution is to clean the code. The solution you propose isn’t a solution you can ask al your website’s visitors to implement.


  • irv


    What is interesting is that I didn’t write the code, Macromedia did. I just want to use an XHR alongside a flash remoting channel. In an ideal world, remoting would not use a persistent connection to Apache, instead it would disconnect after a timeout. The real solution is to not use Ajax and Flash Remoting at the same time, but if you have to, use the flash to JavaScript bridge to disconnect remoting. We did heavy load testing with scripts coming in from around the world, literally, and found no problem with garden variety hardware.

  • http://Website Mark

    I’m an end user with a similar hang problem, (using WinXP with IE7 then 8) while playing games on Facebook. I have several pages open at the same time and after a few clicks on each it starts to hang.Task manager shows many instances of IE running (most are endable) or I restart pc to fix problem for another 10-15 mins. Connections already set to 10 and 10 (using a’s) in registry.
    I got around it by using Firefox for these applications but, (being an admin in training) I’m still looking for why.

  • http://Website Mark

    I re-edited the registry which fixed 90% of the hang problem in IE8 so, thankyou irv! :)
    I’ve since heard of many people using Firefox for Facebook gaming to avoid this “IE problem”.

  • irv

    I recently had to recommend Firefox to a family member for exactly this reason. Videos take forever to load in IE. I can’t believe that they still haven’t fixed this problem. Its been around since IE 5.5!