amphp / postgres

Async Postgres client for PHP based on Amp.
MIT License
95 stars 20 forks source link

[2.0.0 Beta 4] ErrorException: pg_connection_busy(): Cannot set connection to nonblocking mode #58

Closed PNixx closed 1 year ago

PNixx commented 1 year ago
#0 [internal function]: PC\Worker\AbstractWorker->errorHandler()
#1 vendor/amphp/postgres/src/Internal/PgSqlHandle.php(106): pg_connection_busy()
#2 vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(571): Amp\Postgres\Internal\PgSqlHandle::Amp\Postgres\Internal\{closure}()
#3 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#4 vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(478): Fiber->resume()
#5 vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(533): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#6 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#7 vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(105): Fiber->resume()
#8 vendor/revolt/event-loop/src/EventLoop/Driver/EventDriver.php(119): Revolt\EventLoop\Internal\AbstractDriver->run()
#9 vendor/workerman/workerman/src/Events/Revolt.php(88): Revolt\EventLoop\Driver\EventDriver->run()
trowski commented 1 year ago

It seems a number of ext-pgsql functions such as pg_connection_busy() will emit an E_NOTICE when the underlying connection has closed or errored. I updated the handler to close the connection with a ConnectionException now, which will likely fail whatever query was associated with the connection.