I've been chasing a problem with Apache for the past several months now that I finally was able to solve last night. After upgrading to Apache 2.2.6 and installing ColdFusion 8, I started having intermittent problems with images not loading on pages, very slow page loads, or page requests simply hanging. At first, I thought the problem was a ColdFusion Apache connector problem, because I could only make it happen when I was running Apache with ColdFusion. After a long and tedius testing and troubleshooting process, I was finally able to narrow the issue to Apache itself, and not the JRun connector for ColdFusion.
I caught a big break when I saw the following error message in my logs:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
[warn] (OS 995)The I/O operation has been aborted because of either a thread exit or an application request. : winnt_accept: Asynchronous AcceptEx failed.
1[warn] (OS 995)The I/O operation has been aborted because of either a thread exit or an application request. : winnt_accept: Asynchronous AcceptEx failed.
I had seen the same error before a few months back, but Googling the error didn't produce anything useful in past attempts. Last night, for whatever reason, I hit pay dirt. This blog entry put me on the right track. I'm not sure why I didn't find it before as it was posted in 2006, but that really isn't important.
The blog post suggests that the error is caused by a conflict between one or more programs (anti-virus, firewall, virtualization, or vpn) and AcceptEx(), and goes on to say that disabling it using the win32DisableAcceptEx directive should solve the problem. Curious, I googled win32DisableAcceptEx and found this in the Apache docs:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
AcceptEx() is a Microsoft WinSock v2 API that provides some performance improvements over the use of the BSD style accept() API in certain circumstances. Some popular Windows products, typically virus scanning or virtual private network packages, have bugs that interfere with the proper operation of AcceptEx(). If you encounter an error condition like:
[error] (730038)An operation was attempted on something that is not a socket.: winnt_accept: AcceptEx failed. Attempting to recover.
you should use this directive to disable the use of AcceptEx().
1AcceptEx() is a Microsoft WinSock v2 API that provides some performance improvements over the use of the BSD style accept() API in certain circumstances. Some popular Windows products, typically virus scanning or virtual private network packages, have bugs that interfere with the proper operation of AcceptEx(). If you encounter an error condition like:
2
3[error] (730038)An operation was attempted on something that is not a socket.: winnt_accept: AcceptEx failed. Attempting to recover.
4
5you should use this directive to disable the use of AcceptEx().
Here's the relevant section from my Apache 2.2.6 httpd.conf file that needed to be changed:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
EnableMMAP off #<-- uncomment this line
EnableSendfile off #<-- uncomment this line
Win32DisableAcceptEx #this line had to be added
1# EnableMMAP and EnableSendfile: On systems that support it,
2# memory-mapping or the sendfile syscall is used to deliver
3# files. This usually improves server performance, but must
4# be turned off when serving from networked-mounted
5# filesystems or if support for these functions is otherwise
6# broken on your system.
7#
8EnableMMAP off #<-- uncomment this line
9EnableSendfile off #<-- uncomment this line
10Win32DisableAcceptEx #this line had to be added
Although the Apache documentation doesn't mention the EnableMMAP and EnableSendfile directives, I found that I had to disable them as well (as per the first blog post I found). To do so, you'll notice that I simply had to uncomment the EnableMMAP off line as well as the EnableSendfile off line. The win32DisableAcceptEx line is a little less obvious. It isn't included anywhere in the default httpd.conf file, but it was listed in the Apache docs, so I just added the directive after the EnableSendfile off.
After a quick restart of the Apache service, I ran through my battery of tests across all of my instances and wouldn't you know it, problem solved!
1/5/08 6:15 PM
I ran into this error a couple of years when running Apache 2.0.x. I ended up finding a bug report in the Apache httpd projects Bugzilla that explain the solution. I have seen this error yet on our Apache 2.2 Windows server but it isn't in production yet and I suspect this problem only appears under load.
1/7/08 9:57 AM
Hi Kurt,
Glad to know I'm not the only person who has run into this. In my case, it's only happened on my laptop - everyone else in my company is running the same config on slightly different machines with no problems, and all of our dev/qa/prod servers seem to be ok as well.
I'm not sure what about my specific config is causing the problem, but I'm at least glad to have a solution after banging my head against the wall.
1/24/08 12:00 AM
This was a big help. I encountered this problem when using https with my site. You could tell the server had problems with the timeout as it lagged. Regular http seemed fine.
Looking at the eror log I found:
(OS 121)The semaphore timeout period has expired. : winnt_accept: Asynchronous AcceptEx failed.
(OS 64)The specified network name is no longer available. : winnt_accept: Asynchronous AcceptEx failed.
Added the directives to my conf file as described in the article.
Things seem to be fine now. Thanks for posting.
1/24/08 11:27 AM
Hi Doug,
I'm glad this helped you out. It was a real PITA to track down and was driving me nuts for quite some time.
1/27/08 12:01 PM
I'm noticing significantly more memory usage by apache after adding these directives (2x)-- but no errors. I read on other sites that disabling accepteEx might cause intermittent crashing;
I'll let you know if it does. I'm using it under load to serve static images for a site that gets over 250k page views per day. Been running it about 20 minutes now and apache's RAM usage appears to have stabilized.
1/27/08 12:27 PM
Just an update-- still going strong and apache's memory has slowly crawled back down to normalish levels. Maybe it always does that and I hadn't paid attention before.
6/14/08 12:13 AM
Been running it about 20 minutes now and apache's RAM usage appears to have stabilized.
6/20/08 7:14 PM
Great post dude. I've been combating this issue for awhile now - it seems to have resolved it - and mended my heart. Big thanks.
10/6/08 2:40 PM
This change resulted in a 5 fold increase in my httpd.exe process size. Usually running ~130 MB process size. With this change to my httpd.conf file, the exe process skyrocketed to ~700 MB within minutes.
Any ideas? My logs are innundated with this AcceptEx error but the server performs well and I havent noticed anything wrong besides this spam in my error logs.
12/4/08 2:04 PM
Oh man oh man. You have Made My Day! I've been hunting around for a solution to this problem for 2 years. I've been tearing (what's left of) my hair out!
I had run into the Win32DisableAcceptEx thing and tried it many times, but the combination with EnableSendFile off and EnableMMAP off finally did the trick.
Thank you thank you thank you thank you thank you.
12/4/08 2:35 PM
Jeff,
I'm glad this solved your problem. It was a frustrating issue indeed.
1/25/09 4:08 PM
we ran into this error 2 days back and were able to solve it using the
info in another website.
what I am interested in knowing is does the directive win32disableaccepte
cause any memory leak in win2000 server?
I have seen some postings about Xp and 2003.
any info is appreciated
2/4/09 5:18 AM
Since a while, I am also encountering the error 'The specified network name is no longer available. : winnt_accept: Asynchronous AcceptEx failed'.
And until now I haven't found any solutions.
Before trying the config settings, I would like to know what kind of tests you performed to reproduce the error as for me it seems occurring randomly (even if I know it doesn't :-) ).
Thanks
2/20/09 10:04 AM
I too have had this since I started the server (2.2.8) in April of last year. I always wondered about the errors but since things seemed to work okay and as a newbie to Apache I didn't want to tamper with it. Finally curiousity and the fact that most of the error log was made up of these entries, I decided it was time to do something about it.
So here I am and 24 hours after making the recommended changes I say... It worked.
Thank you. :)
8/17/09 2:22 PM
I am still curious to know the root cause of the problem. For me , the site becomes very slow (and hangs) , if i do not turn EnableSendfile off. But curious to know, if making some changes to Win OS , can help me getting rid of this problem
8/26/09 8:02 PM
I also met this problem couple days ago. and page loaded slow, sometime stuck sever to accept any connections, and system periodically gave out AcceptEx failed errors. Really made me headache, tomcat always lags to receive the request from apache. But when I saw your posting,and change the apache conf, everything goes well. Page loaded fast, tomcat got request simultaneously, everything works great. I use windows XP as platform. It is apache 2.2, tomcat 6.0.
Thanks you so much!!!!!!!!!!!!!!
12/30/09 5:14 AM
WOW!!
Thank you for this post.
Looking months for a solution to the winnacept error (using apache 2.2.10 on a XP machine)
Today the problems got worse, for a newly added virtual hosts the index.php wouldn't load automatically, i had to specify the file in the URL. After implementing this fix all works as designed (just giving the site in the url does the job).
Great job!
1/11/10 4:19 PM
This is also an issue with flex builder 3. Running an app from the eclipse IDE repeatedly will eventually cause the apache server to hang. For a while i was having to run the app 3 times before it would start. I modified the httpd.conf file as you suggest and so far the problem has not occurred again - only been testing for a few minutes though.
3/3/10 2:15 PM
Thanks for this - it fixed my problem.
6/26/10 7:49 PM
Just ran into this problem - just installed Apache & PHP5 -
At first it couldn't find the php5apache2_2.dll. Found one
that (supposedly) matched the version of Apache I have, then
we graduated to the message, so I added the 3 lines to the
.conf file and now it refuses to start and pops no error messages
at all. Possibly the php5apache2_2.dll files i brought in is the
problem. Gonna go watch Law & Order to clear my brain....
1/17/11 1:10 PM
This worked on a WIndows 2008 server running Apache 2.
6/19/11 1:13 AM
I am using apache on my XP OS system and the only time I ever get this ( The semaphore timeout period has expired. : winnt_accept: Asynchronous AcceptEx failedm ) in my error log is when I run a virus scan on my Program Files, When I scan any other paths/folders and not Program Files I never get tye error in my log Apache file.
10/2/11 9:49 AM
Thanks a lot for posting this! I had been suffering a not working Apache in XAMPP for over a month on one machine (W7) whilst the sychronized exactly identical XAMPPs on WinXP machines worked fine, and had been searching and trying several things in vain, till I saw the Apache error log being flooded with dozens of MBs with errors recommending the use of Win32DisableAcceptEx, all starting after one single error: 'winnt_accept: the Asynchronous AcceptEx failed', and then found your post. Finally the server reacts again.....
Still I wonder what is the background. The problem started after I had trying to switch from XAMPP to Wamp. That worked fine on the WinXP machines, but resulted in long waits (dozens of seconds), partial loads, time-outs, basically an unusable server, on the synced W7 machine. Unfortunately, this behaviour remained even after I deinstalled Wamp and returned to XAMPP again. I assume Wamp has changed something on the W7 machine, that made Apache sensitive for this Asynchronous AcceptEx thing. But what? Anyhow, I'm highly relieved to have Apache working again on my W7 machine. Thanks again for posting this!
10/12/11 10:57 AM
FYI I added the same directives:
EnableMMAP off
EnableSendfile off
to increase our file transfer performance when we upgraded our ISP connection. We were maxing out around 350 KB/sec for a file transfer thru apache when these were disabled. After turning off EnableMMAP & EnableSendfile, we are getting close to our max badnwidth of 4 MB/sec.
Thanks for the info.
10/4/12 10:08 AM
Had these messages in my Apache error.log:
[warn] (OS 64)The specified network name is no longer available. : winnt_accept: Asynchronous AcceptEx failed.
Added the 3 directives, as suggested here:
EnableMMAP off
EnableSendfile off
Win32DisableAcceptEx
Restarted Apache and solved the problem.
Apache 2.2 Win32 running on a Win64 system. System developped using mod_perl. I'd even say it even improved performances. Awesome, thank you!