Solution to “No such file or directory: Couldn’t initialize cross-process lock in child” in Apache 2.2.13 on FreeBSD 8.0

This issue in the Apache error log was causing the web server to “partially crash” during a graceful restart with the following errors:

[Tue Feb 09 18:24:52 2010] [emerg] (2)No such file or directory: Couldn't initialize cross-process lock in child (/etc/opt/HybridCluster/apache2/logs/accept.lock.82760) (5)
[Tue Feb 09 18:24:52 2010] [notice] Apache/2.2.13 (FreeBSD) PHP/5.2.11 with Suhosin-Patch mod_ssl/2.2.13 OpenSSL/0.9.8k configured -- resuming normal operations
[Tue Feb 09 18:24:52 2010] [alert] Child 85206 returned a Fatal error... Apache is exiting!

Previously reported here, this issue occurs when hammering Apache simultaneously with requests and graceful restarts. Sometimes it would take several hours for the problem to manifest. The consequence is that Apache gets stuck with only two worker processes, meaning that requests succeed but very slowly — as they get queued — when under any load. Insidious! The solution was to change the type of locking Apache was using in httpd.conf:

AcceptMutex fcntl

This is a problem on FreeBSD 8.0 with Apache 2.2.13 using the prefork MPM, with the default UFS2 filesystem for the locks directory.

I hope someone finds this useful!

2 Responses to “Solution to “No such file or directory: Couldn’t initialize cross-process lock in child” in Apache 2.2.13 on FreeBSD 8.0”

  1. alank says:

    This fix proved to be the thing that made php apc start with apache. However, the former seemed to be unhappy with the environment so I shut if off. There was too much fragmentation and not enough memory. That’s about as articulate as I can be about it. Cheers.

  2. Jesse says:

    Someone did find this useful! Though it seems like a long list of conditions, we had this happening on a couple machines. Thanks for posting the solution!

Leave a Reply