Using a 2.6.30-gentoo-r4 Linux a very complex system of php code is executed (with 4.4.9-pl0-gentoo and 5.2.10-pl0-gentoo), which occasionally runs into a semaphore blocking problem. The call to the php function sem_acquire is blocked, bringing the system ultimately to a crash. However, this semaphore in question does not seem to be blocked by another php process, which led me to investigate further. I was able to identify the php process in question and to strace it, leading to the blocking semaphore: ....09:03:25 gettimeofday({1415696605, 778078}, NULL) = 009:03:25 close(5)                       = 009:03:25 gettimeofday({1415696605, 778483}, NULL) = 009:03:25 gettimeofday({1415696605, 778708}, NULL) = 009:03:25 semop(0, 0xbf8f1692, 1 <unfinished ...>This particular output semop(0, 0xbf8f1692, 1) is not of much help to me, since I cannot see the content of struct sembuf (second argument to semop). Maybe someone else sees a problem directly with this semop call? Anyway, I continued the investigation to check the memory at address 0xbf8f1692 (as root):> gdb --pid 1236   GNU gdb 6.8Copyright (C) 2008 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.  Type show copyingand show warranty for details.This GDB was configured as i586-pc-linux-gnu.Attaching to process 1236ptrace: Operation not permitted.(gdb) dump memory /root/output 0xbf8f1692 0xbf9f1692 (gdb) quit> hexdump -C output 00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|*00100000Does this mean the semop is called with a struct sembuf pointing to a bunch zeros? Or did I do something wrong to find out the memory to see what the arguments to semop are? Are there different ways to see what is going on in that semop call?Additional information:The Linux system neither knows the command prctl nor ptrace.A directory named /proc/sys/kernel/yama does not exist (see suggested information).
How to debug a semop failure?
php;gentoo;gdb;strace;semaphore