Viewing By Category : Apache / Main
January 4, 2008

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



Copyright 1995-2008 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.5.1.