amphp / amphp/process

Uncaught FiberError in Process:start()

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
260
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Calling Process::start() can sometimes lead to AMPHP triggering the following uncaught error in Revolt.

Uncaught FiberError: Cannot suspend in a force-closed fiber in /vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:625
Stack trace:
#0 /vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(625): Fiber::suspend()
#1 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#2 {main}
  thrown in /vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php on line 625

Wrapping the start() call in a try-catch does catch the error in the main thread, but this appears to be uncaught in a child thread and leads to the uncaught error still being printed to the php error log.

I have not been able to reliably trigger this error. I see it happen sometimes when doing load testing and starting lots of processes at the same time. But this error sometimes does happen with < 100 processes launched.

I also have the uv and ev PHP modules enabled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Process::start() and the Revolt event-loop location shown at vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:625. Reproduce under load by launching many processes, including configurations with the uv and ev PHP modules enabled, and compare behavior below and above 100 processes. Done means the intermittent FiberError is characterized and no longer reaches the PHP error log from a child thread.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.