swoole / library

📚 Swoole Library
https://wiki.swoole.com/#/library
Apache License 2.0
242 stars 57 forks source link

Detect additional error message "Broken Pipe" as Lost Connection #172

Closed kingIZZZY closed 8 months ago

kingIZZZY commented 8 months ago

Example fatal error trying to use database connection from PDOPool after a long time of not using them

Fatal error: Uncaught ErrorException: PDOStatement::execute(): Send of 2109 bytes failed with errno=32 Broken pipe in @swoole/library/core/Database/PDOStatementProxy.php:53
Stack trace:
#0 [internal function]: Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler::Hyperf\ExceptionHandler\Listener\{closure}(8, 'PDOStatement::e...', '@swoole/library...', 53)
#1 @swoole/library/core/Database/PDOStatementProxy.php(53): PDOStatement->execute(Array)
#2 /home/dev/project/app/Tasks/SomethingTask.php(1921): Swoole\Database\PDOStatementProxy->__call('execute', Array)
#3 [internal function]: App\Tasks\SomethingTask::batch('1', NULL, Array, 93, false)
#4 {main}
  thrown in @swoole/library/core/Database/PDOStatementProxy.php on line 53

Candidate strings

See also