swoft
swoft copied to clipboard
Pool error is Swoft\Connection\Pool\AbstractPool::popByChannel(): Send of 5 bytes failed with errno=110 Operation timed out file=/var/www/vendor/swoft/connection-pool/src/AbstractPool.php line=289. (At /var/www/vendor/swoft/db/src/DB.php line 81)
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | no |
| Swoft version | 2.0.11 |
| Swoole version | 4.8.6 |
| PHP version | 7.4.27 |
| Runtime environment | Docker etc |
Describe the bug 数据库连接池popByChannel() Send of 5 bytes failed with errno=110 Operation timed out,导致请求失败
Expected behavior 应用启动一段时间过后,通常12小时以上,当再次发起请求,会出现如上报错
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
Dockerfile
FROM phpswoole/swoole:4.8-php7.4-alpine RUN set -ex \ && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories \ && apk update \ && apk add --no-cache --virtual .build-deps ca-certificates curl tar xz libressl libstdc++ openssl openssl-dev tzdata pcre autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c pcre-dev zlib-dev libpng-dev freetype-dev libjpeg-turbo-dev icu-dev libzip-dev mosquitto-dev \ && pecl update-channels \ && pecl install redis-stable \ && pecl install mongodb-stable \ && pecl install Mosquitto-alpha \ && docker-php-ext-enable redis mongodb mosquitto \ && docker-php-ext-install pdo_mysql bcmath gd sysvshm sysvmsg sysvsem zip intl
数据库连接池配置

测试发现,minActive = 5,则前面连续5次请求均失败,第6次恢复正常
这个问题已经很久了官方都没有解决,只能自己在定时器上写个查询,不停的给DB发查询请求来保活;我现在改了连接池的底层实现,但偶尔还会来一个上面那样的请求错误。 这样的更新维护效率swoft终究是要被淘汰的。