cluster icon indicating copy to clipboard operation
cluster copied to clipboard

Stacktrace of exception thrown in workers is not logged

Open vfsoraki opened this issue 5 years ago • 1 comments

When an exception is thrown in worker, only the message and code of exception is logged.

A stacktrace is logged, but it is the stacktrace of Process and its state, not the actual stacktrace of exception.

Example:

[2021-02-02T14:15:37.836279+00:00] cluster-86033.error: Worker 2 failed: Amp\Parallel\Sync\ContextPanicError: Uncaught Error in child process or thread with message "Call to a member function get() on null" and code "0"; use Amp\Parallel\Sync\ContextPanicError::getOriginalTrace() for the stack trace in the child process or thread in /<project-path>/vendor/amphp/parallel/lib/Sync/ExitFailure.php:46

This exception causes my workers to die (not a bug with Cluster, bug from my code). But logged error does not help at all. I had to to the classical dump&die starting from worker script to find out where was the error.

Is this expected behavior? Am I missing something?

My worker code is pretty much like HTTP server example from this repo.

I'm willing to look into it, if this is an issue.

vfsoraki avatar Feb 02 '21 14:02 vfsoraki

As a note, the bug in my code happened before loop is actually started.

Maybe that is the reason the exception is not logged properly.

vfsoraki avatar Feb 02 '21 14:02 vfsoraki