|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-06-08 08:33 UTC] devel at jasonwoods dot me dot uk
Description:
------------
I had a spinning process eating 100% CPU on a server this morning. Attaching strace it was stuck in an infinite loop with the following:
kill(2260, SIGKILL) = -1 EPERM (Operation not permitted)
fcntl(3, F_GETLK, {type=F_RDLCK, whence=SEEK_SET, start=1, len=1, pid=2260}) = 0
The process it was attempting to kill was a member of a different FPM pool, and was running under a different user, thus the EPERM.
Stack trace of the spinning process when attaching gdb was:
#0 0x00007f33ebaf9777 in kill () from /lib64/libc.so.6
#1 0x00007f33e4b9f4a2 in kill_all_lockers () at /usr/src/debug/php-5.6.30/ext/opcache/ZendAccelerator.c:606
#2 accel_is_inactive () at /usr/src/debug/php-5.6.30/ext/opcache/ZendAccelerator.c:661
#3 accel_activate () at /usr/src/debug/php-5.6.30/ext/opcache/ZendAccelerator.c:2192
#4 0x00000000005d80ee in zend_llist_apply (l=<value optimized out>, func=0x5d4290 <zend_extension_activator>) at /usr/src/debug/php-5.6.30/Zend/zend_llist.c:191
#5 0x00000000005d5eba in init_executor () at /usr/src/debug/php-5.6.30/Zend/zend_execute_API.c:161
#6 0x00000000005e4ae3 in zend_activate () at /usr/src/debug/php-5.6.30/Zend/zend.c:936
#7 0x0000000000582652 in php_request_startup () at /usr/src/debug/php-5.6.30/main/main.c:1647
#8 0x0000000000693f2d in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/php-5.6.30/sapi/fpm/fpm/fpm_main.c:1927
My hypothesis based on limited reading of how this works is that it seems that a process in some pool held an opcache lock for too long and then another process in another pool attempted to perform an "opcache restart" of sorts, but was unable to complete it as it kept failing to kill a process in another pool for which it has no access. There is no backoff and no "failure" case and so it starts spinning.
Meanwhile, while this was happening, no processes in the same pool as the hung process were responding to requests. The other pools were responding successfully. Restarting the php-fpm completely recovered the environment.
Expected result:
----------------
No spinning process.
Should the php-fpm coordinator/parent process not handling the opcache restart? Or maybe each pool should be using a different opcache lock so they never conflict?
Actual result:
--------------
Spinning process eating 100% CPU.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 18:00:01 2025 UTC |
I spoke too soon. Running 5.6.31 just had the problem again. strace shows: kill(16099, SIGKILL) = -1 EPERM (Operation not permitted) fcntl(90, F_GETLK, {type=F_RDLCK, whence=SEEK_SET, start=1, len=1, pid=16099}) = 0