swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

DB连接池是否有连接保活机制? #1430

Open dengqingpei1990 opened 3 years ago

dengqingpei1990 commented 3 years ago
Q A
Bug report? yes
Feature request? no
Swoft version v2.0.11
Swoole version 4.4.8
PHP version 7.2.26 (cli)
Runtime environment Docker

Describe the bug 最近应用日志频繁打印
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
导致http请求报错,影响业务。检查mysql错误日志发现有很多连接超时错误:
Aborted connection 220615606 to db: 'xxxxx' user: 'xxxxx' host: '172.31.3.176' (Got timeout reading communication packets) 初步怀疑是连接池内的连接长时间没有发起db请求,导致mysql服务端断开连接(wait_timeout/interactive_timeout均配置的3600)。swoft的db连接池是否没有定期向db发起保活请求? Expected behavior

Screenshots

Details

Describe what you are trying to achieve and what goes wrong.

// paste output here

Provide minimal script to reproduce the issue

// paste code
evilk123 commented 3 years ago

easyswoole,是有的 swoft2.0,应该是没有的