0

The problem is that the script hangs up after some long time. strace returns something like this and nothing else:

Process 7286 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
poll([{fd=13, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC, {1817569, 74651533}) = 0
clock_gettime(CLOCK_MONOTONIC, {1817569, 74734744}) = 0
clock_gettime(CLOCK_MONOTONIC, {1817569, 74812047}) = 0
poll([{fd=13, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=13, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
....

Putting here'n'there debug messages is left as a last resort..

I can run the script with xdebug attached but is there a way to send some POSIX signal to php process which would trigger xdebug to dump current context/stacktrace/localvars?

Is it possible to get 'postmortem dump' of php script?

4
  • that's signal your speaking of is probably an exception Commented Jul 15, 2013 at 6:40
  • not an exception, but POSIX signal by kill sent to php process and caught by xdebug. If anything like that exists, that would be perfect. Commented Jul 15, 2013 at 6:46
  • yeah you can use pcntl_signal to handle posix signals properly, and then throw a good exception Commented Jul 15, 2013 at 6:59
  • @AlainTiemblo yes, but I what about xdebug. I don't know it that well, I would assume that such feature might be there. Or there exists some other way I don't know yet about. Commented Jul 15, 2013 at 7:06

1 Answer 1

2

Xdebug does not have functionality for this. Using pcntl_signal and then using xdebug_print_function_stack is an option, but what you can also do is to create a "function trace". This is something that makes Xdebug write every function call to disk as soon as they happen. This should be able to tell you where your script hangs. From what I can see though is that is waiting for IO.

There is more information about function traces at http://www.xdebug.org/docs/execution_trace

Sign up to request clarification or add additional context in comments.

1 Comment

thanks! Even though it is too much for the case but it will definitely help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.