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:


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


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().

Here's the relevant section from my Apache 2.2.6 httpd.conf file that needed to be changed:


# 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

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!

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Kurt Wiersma's Gravatar 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.
# Posted By Kurt Wiersma | 1/5/08 6:15 PM
Rob Brooks-Bilson's Gravatar 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.
# Posted By Rob Brooks-Bilson | 1/7/08 9:57 AM
Doug M's Gravatar 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.
# Posted By Doug M | 1/24/08 12:00 AM
Rob Brooks-Bilson's Gravatar 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.
# Posted By Rob Brooks-Bilson | 1/24/08 11:27 AM
George's Gravatar 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.
# Posted By George | 1/27/08 12:01 PM
George's Gravatar 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.
# Posted By George | 1/27/08 12:27 PM
?'s Gravatar Been running it about 20 minutes now and apache's RAM usage appears to have stabilized.
# Posted By ? | 6/14/08 12:13 AM
Geoff's Gravatar Great post dude. I've been combating this issue for awhile now - it seems to have resolved it - and mended my heart. Big thanks.
# Posted By Geoff | 6/20/08 7:14 PM
Will's Gravatar 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.
# Posted By Will | 10/6/08 2:40 PM
Jeff Kelley's Gravatar 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.
# Posted By Jeff Kelley | 12/4/08 2:04 PM
Rob Brooks-Bilson's Gravatar Jeff,

I'm glad this solved your problem. It was a frustrating issue indeed.
# Posted By Rob Brooks-Bilson | 12/4/08 2:35 PM
Kash's Gravatar 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
# Posted By Kash | 1/25/09 4:08 PM
zdenis's Gravatar 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
# Posted By zdenis | 2/4/09 5:18 AM
Bruce's Gravatar 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. :)
# Posted By Bruce | 2/20/09 10:04 AM
Sukrit's Gravatar 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
# Posted By Sukrit | 8/17/09 2:22 PM
BB's Gravatar 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!!!!!!!!!!!!!!
# Posted By BB | 8/26/09 8:02 PM
Maartenv's Gravatar 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!
# Posted By Maartenv | 12/30/09 5:14 AM
adamt's Gravatar 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.
# Posted By adamt | 1/11/10 4:19 PM
Tarquin's Gravatar Thanks for this - it fixed my problem.
# Posted By Tarquin | 3/3/10 2:15 PM



Copyright 1995-2010 Rob Brooks-Bilson. All rights reserved.
Aura skin for Raymond Camden's BlogCFC inspired by Joe Rinehart & Steven Erat. This blog is running version 5.9.004.