Reputation: 3410
I have a cron script which hang each night (on staging env), but I cannot use dgb as I used in the past.
Here is the process : ps auxf |grep php
www-data 10187 0.0 0.0 4336 684 ? Ss 02:00 0:00 \_ /bin/sh -c /usr/bin/php -c /etc/php5/cli/php-zend.ini $BASE/resources/cron/cli.php mtd=generateTSAlarms
www-data 10194 0.8 1.0 303612 43984 ? t 02:00 3:29 \_ /usr/bin/php -c /etc/php5/cli/php-zend.ini $BASE/resources/cron/cli.php mtd=generateAlarms
php -v :
PHP 5.6.27-0+deb8u1 (cli) (built: Oct 15 2016 15:53:28)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
I grab gdbinit from https://raw.githubusercontent.com/php/php-src/PHP-5.6.27/.gdbinit, and run gbd -p 10194. I load the gdbinit file and try
(gdb) source /home/cedric/php_5.6.27_gdbinit
(gdb) zbacktrace
Attempt to extract a component of a value that is not a structure.
(gdb) bt
#0 0x00007f532b0eef2d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007f532b0eedc4 in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:137
#2 0x00000000006107ba in zif_sleep ()
#3 0x00000000006e5eaa in dtrace_execute_internal ()
#4 0x00000000007a6860 in ?? ()
#5 0x0000000000734bb0 in execute_ex ()
#6 0x00000000006e5d48 in dtrace_execute_ex ()
#7 0x00000000007a6da3 in ?? ()
#8 0x0000000000734bb0 in execute_ex ()
#9 0x00000000006e5d48 in dtrace_execute_ex ()
#10 0x00000000007a6da3 in ?? ()
#11 0x0000000000734bb0 in execute_ex ()
#12 0x00000000006e5d48 in dtrace_execute_ex ()
#13 0x00000000007a6da3 in ?? ()
#14 0x0000000000734bb0 in execute_ex ()
#15 0x00000000006e5d48 in dtrace_execute_ex ()
#16 0x00000000006f8910 in zend_execute_scripts ()
#17 0x0000000000693cbb in php_execute_script ()
#18 0x00000000007a881b in ?? ()
#19 0x0000000000462bdd in main ()
Why zbacktrace doesn't work as it did ?
Upvotes: 1
Views: 425
Reputation: 451
You might be missing debugsymbols (in your case, php-cli-dbgsym or similar, depending on version). If you're on ubuntu, make sure to have the repositories for the -dbgsym Packages in your sources.list (https://wiki.ubuntu.com/DebuggingProgramCrash).
When starting gdb, it should say before the prompt:
Reading symbols from php...Reading symbols from /usr/lib/debug/.build-id/8e/6ac5059e812667e453294f1f58e105435d82e8.debug...done.
(gdb)
Upvotes: 1