Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php8.2版本 swoole 5.0.3 使用mysqlipool 会报错 mysql server has gone away in @swoole/library/core/Database/MysqliProxy.php(51) #5143

Closed
Mrzhang05204130 opened this issue Sep 1, 2023 · 5 comments

Comments

@Mrzhang05204130
Copy link

在PHP 8.0中,该@运算符不会抑制在PHP 8.0之前已静音的某些类型的错误

E_ERROR -致命的运行时错误.
E_CORE_ERROR -PHP的初始启动中发生致命错误.
E_COMPILE_ERROR -致命的编译时错误.
E_USER_ERROR-用户触发的trigger_error()功能错误.
E_RECOVERABLE_ERROR -可捕获的致命错误.
E_PARSE -编译时解析错误.

是不是和这个问题有关系呢

@jingjingxyk
Copy link

出现这个mysql server has gone away
应该查这些地方:

  1. mysql 服务器端长连接超时设置
  2. client 端 超时 重试机制
  3. 排查网络问题(比如网络不稳定,出现丢包 )

@Mrzhang05204130
Copy link
Author

MysqliProxy 文件
第51行:
$ret = @$this->__object->{$name}(...$arguments);
@ 错误抑制符号无效
依然抛出异常

thrown in @swoole/library/core/Database/MysqliProxy.php on line 51

Fatal error: uncaught mysqli_sql_excepltion: MySQL server has gone away in @swoole/library/core/Database/MysqliProxy.php(51)

错误码为 2006

@jingjingxyk
Copy link

jingjingxyk commented Sep 4, 2023

大佬的解决办法: #4131 (comment)

@matyhtf
Copy link
Member

matyhtf commented Sep 8, 2023

需要捕获 Pdo 异常,然后重新创建一个新的连接对象。实现断线重连

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants