easy-swoole / easyswoole

swoole,easyswoole,swoole framework
https://www.easyswoole.com/
Apache License 2.0
4.75k stars 510 forks source link

mysql连接池 隔段时间会报连接超时 #341

Closed 729343861 closed 4 years ago

729343861 commented 4 years ago

错误信息: Fatal error: Uncaught EasySwoole\ORM\Exception\Exception: SQLSTATE[HY000] [2002] Connection timed out in /www/wwwroot/51kai-houduan/vendor/easyswoole/orm/src/Db/MysqlPool.php:21 Stack trace:

0 /www/wwwroot/51kai-houduan/vendor/easyswoole/pool/src/AbstractPool.php(294): EasySwoole\ORM\Db\MysqlPool->createObject()

1 /www/wwwroot/51kai-houduan/vendor/easyswoole/pool/src/AbstractPool.php(252): EasySwoole\Pool\AbstractPool->initObject()

2 /www/wwwroot/51kai-houduan/vendor/easyswoole/pool/src/AbstractPool.php(226): EasySwoole\Pool\AbstractPool->keepMin(5)

3 {main}

thrown in /www/wwwroot/51kai-houduan/vendor/easyswoole/orm/src/Db/MysqlPool.php on line 21 [2020-05-27 16:15:39 $28293.0] WARNING swManager_check_exit_status: worker#23[pid=12393] abnormal exit, status=255, signal=0

这是什么原因,该如何解决呢

xuanyanwow commented 4 years ago

http://www.easyswoole.com/Cn/Components/Orm/readme.html#%E6%96%AD%E7%BA%BF%E9%97%AE%E9%A2%98 相关文档

729343861 commented 4 years ago

我也做了定时检查连接是否可用,但如文档上说的,无法保证100%正常,如果我的数据实时性非常高,遇到这样的问题该怎么处理呢?

kiss291323003 commented 4 years ago

这也是为什么java之类的语言,强制try

askme-gpt commented 3 years ago

@729343861 请问兄台最后如何解决的?