Uncaught Exception in child process doesn't stop the EventLoop
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 859
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
i think i have found a problem. If the child process throws an uncought exception and is running some repeated tasks or coroutines
I would expect the child process to end if there is an uncought exception and that there is an ContextException thrown in the parent process.
The result ist that the child.php is running forever the repeated task and the main process waiting for the child.php to end.
Without the repeated callback the ContextException is thrown in the main process and the script ends.
I tried to find the problem, but i'am not sure how to solve it:
The runContext() from Context/Internal/functions.php catches the exception and sends an ExitFailure back to the parent process, but the EventLoop::run() at the end of the function is running forever, because of the repeated callback.
The main process receives the exit result, but the join() from ProcessContext never ends, because the child process is still running.
I attached two example files to reproduce the problem.
test.txt
child.txt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached test.txt and child.txt reproductions, then read Context/Internal/functions.php around runContext(), EventLoop::run(), and ProcessContext::join(). Trace how the child reports ExitFailure while its repeated callback keeps the event loop alive. Done means an uncaught child exception terminates the child and allows the parent join to finish with ContextException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100