Skip to content

The library doesn't work after replacing the default ReactPHP event loop with Revolt #74

Open

Description

@szado

After installing revolt/event-loop-adapter-react, which lets you use the Revolt event loop as a drop‑in replacement for the default loop, every database operation now fails with a RuntimeException:

Database closed
#0 /opt/app/vendor/clue/reactphp-sqlite/src/Io/ProcessIoDatabase.php(59): Clue\React\SQLite\Io\ProcessIoDatabase->close()
#1 /opt/app/vendor/evenement/evenement/src/EventEmitterTrait.php(143): Clue\React\SQLite\Io\ProcessIoDatabase->{closure:Clue\React\SQLite\Io\ProcessIoDatabase::__construct():57}(Object(RuntimeException))
#2 /opt/app/vendor/clue/ndjson-react/src/Decoder.php(163): Evenement\EventEmitter->emit('error', Array)
#3 /opt/app/vendor/clue/ndjson-react/src/Decoder.php(136): Clue\React\NDJson\Decoder->handleError(Object(RuntimeException))
#4 /opt/app/vendor/evenement/evenement/src/EventEmitterTrait.php(143): Clue\React\NDJson\Decoder->handleData(NULL)
#5 /opt/app/vendor/react/stream/src/ReadableResourceStream.php(157): Evenement\EventEmitter->emit('data', Array)
#6 /opt/app/vendor/revolt/event-loop-adapter-react/src/Internal/EventLoopAdapter.php(49): React\Stream\ReadableResourceStream->handleData(Resource id #143)
#7 /opt/app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(594): Revolt\EventLoop\React\Internal\EventLoopAdapter::{closure:Revolt\EventLoop\React\Internal\EventLoopAdapter::addReadStream():48}('f', Resource id #143)
#8 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->{closure:Revolt\EventLoop\Internal\AbstractDriver::createCallbackFiber():565}()
#9 /opt/app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(502): Fiber->resume()
#10 /opt/app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(558): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#11 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->{closure:Revolt\EventLoop\Internal\AbstractDriver::createLoopFiber():538}()
#12 /opt/app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(96): Fiber->start()
#13 /opt/app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(116): Revolt\EventLoop\Internal\AbstractDriver->{closure:Revolt\EventLoop\Internal\AbstractDriver::__construct():90}()
#14 /opt/app/vendor/revolt/event-loop-adapter-react/src/Internal/EventLoopAdapter.php(181): Revolt\EventLoop\Internal\AbstractDriver->run()
#15 /opt/app/vendor/react/event-loop/src/Loop.php(250): Revolt\EventLoop\React\Internal\EventLoopAdapter->run()
#16 /opt/app/vendor/clue/framework-x/src/Io/ReactiveHandler.php(77): React\EventLoop\Loop::run()
#17 /opt/app/vendor/clue/framework-x/src/App.php(248): FrameworkX\Io\ReactiveHandler->run(Object(Closure))
#18 /opt/app/src/app.php(17): FrameworkX\App->run()
#19 {main}

Activity

  1. PaulRotmann commented on Aug 4, 2025

    @PaulRotmann
    Contributor

    Thanks for the report and for sponsoring our work!
    The issue appears to be specific to the Revolt event loop adapter. Our CI tests run successfully on both Ubuntu and Windows across PHP versions 5.4-8.4 with the standard ReactPHP event loop, so this seems to be related to how Revolt handles the process communication differently.

    The current stack trace shows a "Database closed" RuntimeException, but without more specific debugging information, it's difficult to pinpoint the exact cause in the Revolt integration.
    If you can identify the root cause or submit a pull request with a fix, we'd be happy to review it. Otherwise, as a workaround, you might consider sticking with the standard ReactPHP event loop for now.

    Thanks for your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions