Skip to content

Emitting of an error from Messenger in Child process is never handled #115

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

Open
lucasnetau opened this issue Mar 29, 2023 · 0 comments
Open

Comments

@lucasnetau
Copy link
Contributor

In a Child Process the Messenger class can emit errors in crashed() and iterateMessages() however there is no listener for these error events. The RPC message is never responded to and the parent waits forever.

A quick fix is adding the following in the Process::create() factory

$messenger->on('error', function($throwable) use(&$reject, $messenger) {
    $reject($throwable);
});

This will terminate the child process and the parent process will reject the RPC call with CommunicationWithProcessUnexpectedEndException

There may be a better way however I don't know the code well enough and if the error occurs in MessagesFactory::fromLine due to an invalid rpc method then we can't cleanly handle the error.

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

1 participant