Apache server 2.4.6 hangs after serving requests from Internet Explorer 10/11

Symptoms:
Apache 2.4 running on Windows hangs when Internet Explorer 10/11 is used to acces pages on it.

apache-feather-logo-370x229

Reproduction:
I had a very reproducible scenario: Only the first request to Apache coming from IE would work, all other subsequent requests would hang, in all browsers. As long as I did not use Internet Explorer there did not seem to be a problem, but once that was used everything would hang until Apache was restarted. Strangely enough after I had applied the fix (see below) I reverted it to do some more testing but was not able to reproduce the problem anymore…

Migitating factors:
I am not sure of these, just describing the setup I was using when I encountered these problems. If you know more, please leave a comment.

  • Running on Windows 7
  • Using Apache 2.4.6
  • VMWare network drivers installed (see explanation for why this might be relevant)
  • Using an experimental 64-bit build of PHP 5.5: php-5.5.5-Win32-VC11-x64
  • Using Internet Explorer 11
  • Using Twitter Bootstrap, MySQL

Cause:
It seems that I was being hit by an issue with Apache’s Multi-Processing Module optimized for Windows NT. See references below for some sources that describe this problem and the fix.

Fix:
Add this configuration snippet to Apache24/conf/httpd.conf (bottom of file seems fine):

# Apparently this fixes an issue with Apache 2.4.6 on Windows hanging
# when serving requests from Internet Explorer 10/11.
# see https://stijndewitt.wordpress.com/2014/01/10/apache-hangs-ie11/
AcceptFilter http none
AcceptFilter https none

Explanation:
From the Apache docs about AcceptFilter:

This directive enables operating system specific optimizations for a listening socket by the Protocol type.

On Windows, none uses accept() rather than AcceptEx() and will not recycle sockets between connections. This is useful for network adapters with broken driver support, as well as some virtual network providers such as vpn drivers, or spam, virus or spyware filters.

References:

54 comments

  1. I just ran into this issue and you seem to have the solution. I can’t thank you enough!

  2. This is an issue I was having for quite a while. Wasn’t able to figure out what was causing it, but your solution worked perfectly. Thank you!

  3. You’re welcome. And thanks for leaving a comment it is very much appreciated!

  4. Thank you so much for this solution!!!! You’re a genius!!!!! 😉

  5. This issue is specific to Windows, so probably yours is subtly different.
    Can you give more details? Is it only requests coming from IE that make Apache hang? Does it just become slow? Does it get out of it again?
    I don’t have a fix for you now, but if you give more details than other people passing by here might have some useful info for you.

  6. I’ve posted a question to ServerFault: http://serverfault.com/questions/615538/using-ie-to-invoke-php-curl-for-long-running-data-api-causes-apache2-server-to-f

    Essentially – I’m running a PHP program that works fine as long as it’s not invoked by a Microsoft IE browser, after which it spawns the below processes, locks up Apache2 and requires a restart of the web server (on Ubuntu 12.04LTS).

    When accessing the page from any vintage of IE, I get tons of these:

    ps auxwww | grep apache2
    root 8737 0.1 2.5 369164 25800 ? Ssl 12:41 0:00 /usr/sbin/apache2 -k start
    www-data 8743 0.0 3.2 393748 33268 ? Sl 12:41 0:00 /usr/sbin/apache2 -k start
    www-data 8755 0.1 3.3 393856 33904 ? Sl 12:41 0:00 /usr/sbin/apache2 -k start
    www-data 8779 0.1 3.2 393724 33252 ? Sl 12:45 0:00 /usr/sbin/apache2 -k ……..

    It used to lock up the entire server until I changed some of the “mpm_” module parameters to something more reasonable in /etc/spache2/apache2.conf.

    Given the issues with IE, I’ve even added this line:

    **” SetEnvIf User-Agent “.*MSIE.*” nokeepalive “**
    in the virtual hosts file located here: /etc/apache2/sites-available.

    There are a number of articles written on the issue but I’ve not had any success implementing any of them:

    Apache Server2 Hangs after receiving requests from IE 10/11:
    http://stackoverflow.com/questions/13271234/ie10-windows-8-crashing-apache

    The PHP program uses cURL to take a list of 25 items and perform a (GET) API call for each to an external server that returns JSON data for further processing. It’s a classical long running data program.

    What bakes my noodle is that it runs fine in every other browser except IE – which causes the web server to misbehave.

    I’ve interrogated the listed R&D and then some, implemented the suggested fixes, yet I still get the same predictable, recreatable, problematic server behavior.

    What I need to do is figure out how to protect the server from behaving badly when it encounters and IE browser making these particular requests of it. What I’d like to do is understand why it happens in the first place.

    Any guidance, perspectives, direction or solutions would be greatly appreciated….

    -matt

  7. Ha! I asked for details and I got them 🙂

    What you have to remember is that at the server, a request from IE is just like any other HTTP request… So as much as we all like to, we can’t really blame IE for this issue. The issue is definitely with Apache.

    It would seem that IE sends some special HTTP headers or does something with the HTTP request that other browsers don’t do… and that ticks off Apache.

    I think it would be helpful if you could somehow log the incoming HTTP requests from both IE and some other browser and then compare them side by side. There must be some difference in them. Given that difference it may help you to target your search more. Probably StackOverflow is the better place to do the ‘debugging’ on than this blog, so I suggest we continue our discussion there.

  8. Hi, thanks for this post, seems like it sorts me out big time here. I had noticed in project that apache (2.4.10) gets to hang in the infinite while trying log in/out a user, or well it seemed like different kind of operations got hit at random, and tracing that was impossible since apache had to be restarted. The only I knew was that it happened only on IE(10), and the test platform currently was windows 8 pro(eval). I can’t tell how glad I am to know this was not a bad coding problem. Thanks again!

  9. Anyway, this is definitely something that occurs only in a IE/Apache context as I have not had any of this while testing my project on FF/Chrome/Opera. But now, considering the nature of the problem, and since most people still use IE and also since most webservers are apache powered, how comes this issue does not hit us at a greater scale? There’s gotta be something more specific to what really triggers that, like certain type of IE http headers or whatever

  10. I think this problem only happens on Windows. Most servers run Unix. Furthermore I’m guessing that Wamp et al. have changed their default configs to fix this…

    However I don’t think it hits every Apache Windows install… It seems to be related to the network drivers / adapters…

    Can you have a look at the network adapters installed on the machine you saw the issue on? Are there any virtual network adapters or VPN adapters etc installed?

    By the way, looking at the traffic this page gets I am guessing the problem is pretty widepread. I get a dozen or so views of this page every day more or less consistently (a bit less in the weekends).

  11. but that’s a frightening scenario, because once my opensource project is out, there will (hopefully) be people trying to install it on shared servers and who won’t necessarilly have access to httpd.conf. Now I haven’t looked yet if I can implement the same solution in .htaccess but if so then it solves the problem for me at least.

    There’s no vpn involved in my setup, also I don’t know what to look for or where in my network adaptor regarding this, I have only been back on windows, being new to 8, only to test project. Maybe that will count if I say I have VirtualBox installed, seen as unidentified network ‘VB host only network’ in the network manager.

    But as of right now I’m too busy trying to wrap up my project, I’m hoping someone can pinpoints the exact problem soon though

  12. in case I didn’t make that clear though, I’m using Windows 8 pro straight, meaning no Virtualization, and I have VB installed for keeping on testing under *nix, while temporarily on Windows. Hoping that helps

  13. Hi rolande,

    Yes to be honest I too am a bit surprised Apache hasn’t picked up on this. I’m guessing this may be one of those ideological things where Apache is saying that the fault is in the drivers, so not for them to fix… They are talking about broken network drivers on one of those resources I linked.

    “also I don’t know what to look for or where in my network adaptor regarding this [..] I have VirtualBox installed, seen as unidentified network ‘VB host only network’ in the network manager.”

    Yes this is exactly what I am talking about. I too have virtual network adapters installed… I am guessing it’s got to do with this.

    About people installing on shared servers and not having access to httpd.conf… I wouldn’t worry about it too much, because most shared hosts run on *nix anyway and if a shared Windows host has this problem, he will probably quickly notice it and make attempts to fix it. It’s out of your hands then.

    I can understand that you want your project to run smooth. It’s open source you say? Care to tell us something about it? Feel free to post a link.

  14. Hi Stijn, and thanks for your reply, I somehow get the feeling it’s gonna be a VB thing, and yes you are totally right about the nix servers not being impacted on shared, actually I have never seen Windows running on any shared, and if it was the case, assuming too that it’s no VB driver messing up with poor defenseless local windows stations, the host support forums would have exploded because of it anyway, I guess.
    About my current project, I would be more than delighted to introduce it here now, but since I’m also writing a super-series tutorial to go with it, which hasn’t been released yet, I cannot disclose it for now, I am not entitled to by the editor at least. So I’m very sorry about that, however and once it is out, I will be back here and post links to the tutorials, and to the project itself and so on.
    I’m definitely keeping you posted on this
    Cheers – Roland

  15. Thank you very much!
    (It worked for me with Apache 2.4.7 and both “PHP 5.3.28 win32 VC9 x86” and “PHP 5.4.26 win32 VC9 x86”.)

  16. Thank you very much, I am facing this issue since last 2 months and no body believed me that this must be Apache issue not the application. I am constantly checking and cross my finger not to have this problem again.

  17. Thanks for the fix. Our symptoms were a bit weird that people were accessing our Apache 2.4 server running on a Windows virtual server, and it would only deadlock if they were connecting via Cisco VPN’s; but the right google-foo led us to your page.

  18. Thanks for posting this fix. It worked for me. I was experiencing a similar issue on the wiki server I setup on my company’s intranet. My problem would make the whole server hang but if I clicked the link 4 to 5 times it would eventually work and then successive link clicks would work fine. If you let the page sit idle for 2-5 minutes it would then the server would ‘hang’ on the next link click.

  19. Thanks for your comments guys! It’s great this workaround apparently fixes all kinds of problems… I think Apache has a real problem with their Windows implementation of AcceptFilter… Hope they’ll be able to fix it in a future release.

  20. Thank you very much, it seems to work for me too. Unbeliavable. It is year 2015. Things should work much much much better than 10 years ago but it is worse and worse with each release of new software and hardware and new drivers and shit. Once more, if I did not find your page and your solution I would be stuck or I would be forced to migrate back to old stable software. I wonder where all this shit is heading :-)))

  21. Ha ha yeah I know how you feel! I still sometimes yearn for the days when i flipped the power switch on my Commodore 64 and instantly had a working computer 🙂

    Still, in the midst of the chaos good things are happening too! Fanless systems, instant-on, Android, HTML 5. And with the new VR devices coming all software just *must* run at 90+ fps in real time with minimal latency or people get physically unwell… It’s bound to give us improvements in other areas as well.

    IT is still in it’s infancy so it will remain messy for the years to come I guess. Thank you for your comment!

  22. THANK YOU!!!!!!!!!!!! this fix also applies to broken connections made from an android device using HttpURLConnection

  23. Thanks Stijn! Thanks google! Once I realized the problem was with apache, and not the back end, nor the firewall, nor the antivirus–plus that it served the first N requests, then stopped– a google search on “apache freezes up” pointed me to your solution. Most Helpful indeed. Strangest. bug. ever.

  24. You’re welcome Bill, glad it helped. And thanks for the comment I always love it when I get those!

    Oh and thanks Russian (?) blogger for linking to my site. 🙂

  25. Thanks for your comment Willy. It’s interesting that you mentioned having problems connecting from an Android device. I have seen this mentioned before in the comments. So it seems that both Internet Explorer and Android devices are somehow triggering this issue in Apache on Windows.

  26. Fantastic solution! Thanks a lot! This solution works for apche being hosted on Windows Server. I have another environment which has apache on unix and same is accessed from Windows PCs using IE10. Unfortunately, the same solution does not work in unix environment.

  27. Thank you so much for this Stijn! Battled with this issue for weeks before finding your blog. Issue resolved on Apache 2.4.10 running on a Windows Server 2008 R2 environment.

  28. Hi, It works on Chrome as well. I had a script that used to generate CAPTCHA image. Browser Chrome hangs Apache after first execution. As soon as I refresh the page it hangs Chrome and all other browsers.

    After applying your fix, it worked perfectly. No hangs anymore!

    Cheers

  29. Thank you very much! This was bugging me for months. I usually develop with Firefox and never got an error report from users regarding this issue and so I concluded that it had to be some kind of strangeness on my computer. Internet Explorer access from other computers was always fine. I never thought that I’d find anything about this on the web and didn’t search. Took me 10 seconds to type my search query into Google and find your post…

    Conclusion: Never think you’re the only one with the problem, no matter how odd it may seem.

  30. Plus, writing it down sometimes gives you the incidental, warm feeling of having helped someone else when they comment to say ‘thanks’. Yup blogging can be very rewarding! Glad it helped you and thank you very much for taking the time to comment!

  31. Thanks for this solution, I’ve been wrestling with Apache hanging for a while now. Could you explain why I see this problem on a web-server with direct client access but it was not apparent for an identical server installation accessed via a proxy server please?

  32. I had this problem too but I didn’t care to fix it cause I could go on with Chrome as well. Finally I decided to fix it and found this solution. By the moment, you can also use ‘connect’ instead of ‘none’ because the Apache docs state this:
    For versions 2.4.23 and prior, the Windows data accept filter waited until data had been transmitted and the initial data buffer and network endpoint addresses had been retrieved from the single AcceptEx() invocation. This implementation was subject to a denial of service attack and has been disabled.
    Current releases of httpd default to the connect filter on Windows, and will fall back to connect if data is specified. Users of prior releases are encouraged to add an explicit setting of connect for their AcceptFilter, as shown above.

  33. I had this issue for years until I found this link! Thank you so much for sharing this.

Leave a comment