关于ThinkPHP5.0.*版本 cli模式下php每隔段时间就出错
cli模式下php每隔段时间就出错
官方论坛
日志以下:php
Uncaught thinkexceptionErrorException: Error while sending STMT_CLOSE packet. PID=23951 in /www/web/work/public_html/thinkphp/library/think/db/Connection.php:318html
thinkdbConnection::free(): send of 9 bytes failed with errno=32 Broken pipemysql
分析缘由web
解决方案sql
'break_reconnect' => true,thinkphp
public function free()
{数据库
try { $this->PDOStatement = null; } catch (Exception $e) { Log::write("has error when free PDOStatement maybe mysql gone away,skip it:" . $e->getMessage(), log::DEBUG); }
}ide
protected function isBreak($e)
{this
if (!$this->config['break_reconnect']) { return false; } $info = [ 'server has gone away', 'no connection to the server', 'Lost connection', 'is dead or not enabled', 'Error while sending', 'decryption failed or bad record mac', 'server closed the connection unexpectedly', 'SSL connection has been closed unexpectedly', 'Error writing data to the connection', 'Resource deadlock avoided', 'failed with errno', 'send of 33 bytes failed with errno=32 Broken pipe', ]; $error = $e->getMessage(); foreach ($info as $msg) { if (false !== stripos($error, $msg)) { return true; } } return false;
}.net
做者:HD2killers
来源:CSDN
原文:https://blog.csdn.net/HD2kill... 版权声明:本文为博主原创文章,转载请附上博文连接!