Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error: require(): unable to unlock pthread lock

I'm using LAMP on Debian Linux. Apache 2.2.22-12, PHP 5.4.4.

Sometimes I get this error and then i couldn't reload page or open pages, which includes file with this error. After I've got such error i couldn't restart apache

Restarting web server: apache2(98)Address already in use: make_sock: could not bind to address [::]:80

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down

Unable to open logs

Action 'start' failed.

The Apache error log may have more information. failed!

In apache log file:

[Wed Nov 21 15:07:55 2012] [warn] child process 4020 still did not exit, sending a SIGTERM

[Wed Nov 21 15:07:55 2012] [warn] child process 4021 still did not exit, sending a SIGTERM

[Wed Nov 21 15:07:55 2012] [warn] child process 4022 still did not exit, sending a SIGTERM

[Wed Nov 21 15:07:57 2012] [error] child process 1309 still did not exit, sending a SIGKILL

[Wed Nov 21 15:07:57 2012] [error] child process 1310 still did not exit, sending a SIGKILL

[Wed Nov 21 15:07:57 2012] [error] child process 1311 still did not exit, sending a SIGKILL

And host log:

[Wed Nov 21 12:21:24 2012] [error] [client 127.0.0.1] PHP Fatal error: require(): unable to unlock pthread lock in ~/www/yii/yii-1.1.11.58da45/framework/base/CApplication.php on line 127

There is

$config=require($config);

Or:

[Wed Nov 14 21:04:26 2012] [error] [client 127.0.0.1] PHP Fatal error: require_once(): unable to unlock pthread lock in ~/projects/politiya/index.php on line 14

There is:

require_once($game_loader);

I've deleted php-apc and now lamp works good.

like image 411
Aleh Kashnikau Avatar asked Nov 21 '12 15:11

Aleh Kashnikau


3 Answers

Fix

As mentioned here, I had to quickly uninstall and reinstall apc (literaly takes 5s):

1 sudo pecl uninstall apc

2 sudo pecl install apc

BUT change the no which is already filled in for pthread mutexes into a yes

AND change the yes which is already filled in for pthread read/write locks into a no.

like image 56
Mick Avatar answered Oct 20 '22 18:10

Mick


This error happens because of a 'deadlock bug' in APC. A php bug report page says that, this bug is fixed in APC 3.1.8

Also we can see the APC change logs here

like image 40
Jirilmon Avatar answered Oct 20 '22 16:10

Jirilmon


Just an FYI (in response to OMG's comment about APC version bug), I'm running APC 3.1.13 and PHP 5.4.17 and I still got the bug:

unable to obtain pthread lock (EDEADLK)
like image 2
macinnir Avatar answered Oct 20 '22 18:10

macinnir