I have several crons running at various times every day. Occasionally, one or another will get 'stuck' and its process will never die. This isn't consistent, but after a change in a function in a different file which several of the crons access, there's been a marked increase in the number of times. Not always to the same file, not always to the same time, and running the files manually works fine.
My questions:
If I modify this external file, the running cron should pick up the change, right? (Tried and it isn't working, so either it doesn't, or it didn't get to that point in my code, which brings me to my second question:)
How can I print a stack trace of the running cron in order to see where it gets stuck? Running on Linux, Centos version 7
Edit: pstack
gives me main() - how can I get farther in than that?
#0 0x00007f710a129e0d in poll () from /lib64/libc.so.6
#1 0x00007f7102391ab9 in Curl_poll () from /lib64/libcurl.so.4
#2 0x00007f710238aa4d in curl_multi_wait () from /lib64/libcurl.so.4
#3 0x00007f7102383baf in curl_easy_perform () from /lib64/libcurl.so.4
#4 0x00007f71025c96f6 in zif_curl_exec () from /usr/lib64/php/modules/curl.so
#5 0x00007f71029e6a4d in xdebug_execute_internal (current_execute_data=0x7f710d8f14a0, return_value_used=1) at /var/tmp/xdebug/xdebug.c:1547
#6 0x00007f710dc61271 in zend_do_fcall_common_helper_SPEC ()
#7 0x00007f710dbde617 in execute ()
#8 0x00007f71029e5e3a in xdebug_execute (op_array=0x7f70fa316bc8) at /var/tmp/xdebug/xdebug.c:1435
#9 0x00007f710dc6190d in zend_do_fcall_common_helper_SPEC ()
#10 0x00007f710dbde617 in execute ()
#11 0x00007f71029e5e3a in xdebug_execute (op_array=0x7f710f89efb0) at /var/tmp/xdebug/xdebug.c:1435
#12 0x00007f710dc6190d in zend_do_fcall_common_helper_SPEC ()
#13 0x00007f710dbde617 in execute ()
#14 0x00007f71029e5e3a in xdebug_execute (op_array=0x7f710d921838) at /var/tmp/xdebug/xdebug.c:1435
#15 0x00007f710dbb727f in zend_execute_scripts ()
#16 0x00007f710db56656 in php_execute_script ()
#17 0x00007f710dc63548 in do_cli ()
#18 0x00007f710da1015e in main ()
Thanks for any help!
If any of the crons are leaving the file open then this might be the cause when a concurrent access attempt is made to the same file by different cron instances. You could write a small shell script to execute the code file preceded by something like