Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing condition causes "An unknown error occurred" message instead of useful one #29

Open
MattJaniszewski opened this issue Apr 22, 2015 · 2 comments

Comments

@MattJaniszewski
Copy link
Contributor

Using the following code (sans namespaces and autoloader config):

$dispatcher = new EventDispatcher();
$manager = new ProcessManager($dispatcher);
$manager->setDebug(true);

$callback = function($item) {
    if ($item == 1) {
        throw new \Exception('This message should be shown');
    } else {
        sleep(1);
    }
};

$manager->process([1, 2], $callback, new ChunkStrategy(2));
$manager->wait();

I get the following output (sans stack-trace):

PHP Fatal error:  Uncaught exception 'Spork\Exception\ForkException' with message 'An unknown error occurred in "<anonymous> batch" fork (13677)' in /home/matthew.janiszewski/source/spork/src/Spork/Fork.php:91

If I comment out sleep(1); in the example above, I get the predictable message:

PHP Fatal error:  Uncaught exception 'Spork\Exception\ForkException' with message 'Exception (0) thrown in "<anonymous> batch #0" fork (14551): "This message should be shown" (/home/matthew.janiszewski/source/spork/error_test.php:31) via "<anonymous> batch" fork (14550)' in /home/matthew.janiszewski/source/spork/src/Spork/Fork.php:91

Ideally, in both cases "This message should be shown" should be displayed, rather than only in the latter case.

@alex-kovalchuk
Copy link

Hi. Do you fixed this issue?

Sometimes, I receive the following error:

  [Spork\Exception\ForkException]                              
  An unknown error occurred in "<anonymous> batch" fork (952)

Thank you!

@alex-kovalchuk
Copy link

Hi.
I fixed this error. Fatal error was found in my methods.. Spork does not show this error.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants