服务器上的docker环境里
运行一段时间后服务器上就报这样的错误
数据库相关配置
'type' => 'mysql',
'hostname' => $dbConfig['DB_HOST_ADDR'],
'username' => $dbConfig['DB_USERNAME'],
'password' => $dbConfig['DB_PASSWORD'],
'hostport' => $dbConfig['DB_HOST_PORT'],
'params' => [
PDO::ATTR_TIMEOUT => 3,
],
'charset' => 'utf8mb4',
'break_reconnect' => true, // 断线重连
'trigger_sql' => $dbConfig['DB_DEBUG'],
'prefix' => $dbConfig['DB_PREFIX'],
// 连接池配置
'pool' => [
'max_connections' => 5, // 最大连接数
'min_connections' => 1, // 最小连接数
'wait_timeout' => 10, // 从连接池获取连接等待超时时间
'idle_timeout' => 120, // 连接最大空闲时间,超过该时间会被回收
'heartbeat_interval' => 59, // 心跳检测间隔,需要小于60秒
],
think\db\exception\PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while there are pending result sets. Consider unsetting the previous PDOStatement or calling PDOStatement::closeCursor() in /app/vendor/topthink/think-orm/src/db/PDOConnection.php:861
Stack trace:
#0 /app/vendor/topthink/think-orm/src/db/PDOConnection.php(688): think\db\PDOConnection->getPDOStatement('select 1', Array, false)
#1 /app/vendor/webman/think-orm/src/DbManager.php(60): think\db\PDOConnection->query('select 1')
#2 /app/vendor/workerman/coroutine/src/Pool.php(328): Webman\ThinkOrm\DbManager->Webman\ThinkOrm\{closure}(Object(think\db\connector\Mysql))
#3 /app/vendor/workerman/coroutine/src/Pool.php(309): Workerman\Coroutine\Pool->trySendHeartbeat(Object(think\db\connector\Mysql))
#4 /app/vendor/workerman/coroutine/src/Pool.php(132): Workerman\Coroutine\Pool->checkConnections()
#5 /app/vendor/workerman/workerman/src/Events/Swoole.php(288): Workerman\Coroutine\Pool->Workerman\Coroutine\{closure}()
#6 [internal function]: Workerman\Events\Swoole->Workerman\Events\{closure}()
#7 {main}
think\db\exception\PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while there are pending result sets. Consider unsetting the previous PDOStatement or calling PDOStatement::closeCursor() in /app/vendor/topthink/think-orm/src/db/PDOConnection.php:861
Stack trace:
#0 /app/vendor/topthink/think-orm/src/db/PDOConnection.php(688): think\db\PDOConnection->getPDOStatement('select 1', Array, false)
#1 /app/vendor/webman/think-orm/src/DbManager.php(60): think\db\PDOConnection->query('select 1')
#2 /app/vendor/workerman/coroutine/src/Pool.php(328): Webman\ThinkOrm\DbManager->Webman\ThinkOrm\{closure}(Object(think\db\connector\Mysql))
#3 /app/vendor/workerman/coroutine/src/Pool.php(309): Workerman\Coroutine\Pool->trySendHeartbeat(Object(think\db\connector\Mysql))
#4 /app/vendor/workerman/coroutine/src/Pool.php(132): Workerman\Coroutine\Pool->checkConnections()
#5 /app/vendor/workerman/workerman/src/Events/Swoole.php(288): Workerman\Coroutine\Pool->Workerman\Coroutine\{closure}()
#6 [internal function]: Workerman\Events\Swoole->Workerman\Events\{closure}()
#7 {main}
Running composer update...
Load env file: production
Workerman[start.php] start in DEBUG mode
Master pid:22 is not alive
--------------------------------------------------------- WORKERMAN ----------------------------------------------------------
Workerman/5.1.3 PHP/8.3.22 (JIT off) Linux/5.10.134-18.al8.x86_64
---------------------------------------------------------- WORKERS -----------------------------------------------------------
event-loop proto user worker listen count state
swoole tcp root webman http://0.0.0.0:8787 4 [OK]
event tcp root monitor none 1 [OK]
event tcp root plugin.webman.redis-queue.consumer none 2 [OK]
composer show
adbario/php-dot-notation 2.5.0 PHP dot notation access to arrays
alibabacloud/tea 3.2.1 Client of Tea for PHP
alibabacloud/tea-fileform 0.3.4 Alibaba Cloud Tea File Library for PHP
alipaysdk/easysdk 2.2.3 支付宝官方 Alipay Easy SDK
carbonphp/carbon-doctrine-types 3.2.0 Types to use Carbon in Doctrine
chinayin/ip2region-core 2.0.4 Ip2region (2.0 - xdb) is a offline IP address manager framework and locator with ten microsecond searching performance. ...
doctrine/inflector 2.0.10 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singu...
firebase/php-jwt 6.11.1 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
guzzlehttp/guzzle 7.9.3 Guzzle is a PHP HTTP client library
guzzlehttp/promises 2.2.0 Guzzle promises library
guzzlehttp/psr7 2.7.1 PSR-7 message implementation that also provides common utility methods
guzzlehttp/uri-template 1.0.4 A polyfill class for uri_template of PHP
illuminate/bus 10.48.28 The Illuminate Bus package.
illuminate/collections 10.48.28 The Illuminate Collections package.
illuminate/conditionable 10.48.28 The Illuminate Conditionable package.
illuminate/container 10.48.28 The Illuminate Container package.
illuminate/contracts 10.48.28 The Illuminate Contracts package.
illuminate/events 10.48.28 The Illuminate Events package.
illuminate/macroable 10.48.28 The Illuminate Macroable package.
illuminate/pipeline 10.48.28 The Illuminate Pipeline package.
illuminate/redis 10.48.28 The Illuminate Redis package.
illuminate/support 10.48.28 The Illuminate Support package.
monolog/monolog 2.10.0 Sends your logs to files, sockets, inboxes, databases and various web services
nesbot/carbon 2.73.0 An API extension for DateTime that supports 281 different languages.
nikic/fast-route 1.3.0 Fast request router for PHP
psr/cache 3.0.0 Common interface for caching libraries
psr/clock 1.0.0 Common interface for reading the clock.
psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11)
psr/http-client 1.0.3 Common interface for HTTP clients
psr/http-factory 1.1.0 PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message 2.0 Common interface for HTTP messages
psr/log 3.0.2 Common interface for logging libraries
psr/simple-cache 3.0.0 Common interfaces for simple caching
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
revolt/event-loop 1.0.7 Rock-solid event loop for concurrent PHP applications.
symfony/cache 7.3.0 Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts 3.6.0 Generic abstractions related to caching
symfony/console 7.3.0 Eases the creation of beautiful and testable command line interfaces
symfony/deprecation-contracts 3.6.0 A generic function and convention to trigger deprecation notices
symfony/polyfill-ctype 1.32.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme 1.32.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer 1.32.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring 1.32.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80 1.32.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/service-contracts 3.6.0 Generic abstractions related to writing services
symfony/string 7.3.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation 6.4.22 Provides tools to internationalize your application
symfony/translation-contracts 3.6.0 Generic abstractions related to translation
symfony/var-exporter 7.3.0 Allows exporting any serializable PHP data structure to plain PHP code
tinywan/exception-handler 1.6.1 webman exception handler plugin
tinywan/jwt 1.11.3 JSON Web Token (JWT) for webman plugin
topthink/think-container 3.0.2 PHP Container & Facade Manager
topthink/think-helper 3.1.11 The ThinkPHP6 Helper Package
topthink/think-orm 4.0.44 the PHP Database&ORM Framework
topthink/think-validate 3.0.7 think validate
voku/portable-ascii 2.0.3 Portable ASCII library - performance optimized (ascii) string functions for php.
webman/console 2.1.8 Webman console
webman/log 2.1.3 Webman plugin webman/log
webman/redis 2.1.3 Webman redis
webman/redis-queue 2.1.0 Redis message queue plugin for webman.
webman/think-orm 2.1.6
wechatpay/wechatpay 1.4.12 [A]Sync Chainable WeChatPay v2&v3's OpenAPI SDK for PHP
workbunny/webman-shared-cache 0.6.1 Webman plugin workbunny/webman-shared-cache
workerman/coroutine 1.1.3 Workerman coroutine
workerman/http-client 3.0.3
workerman/psr7 2.0.2 PSR-7 message implementation that also provides common utility methods
workerman/redis 2.0.5
workerman/redis-queue 1.2.1 Message queue system written in PHP based on workerman and backed by Redis.
workerman/webman-framework 2.1.2 High performance HTTP Service Framework.
workerman/workerman 5.1.3 An asynchronous event driven PHP framework for easily building fast, scalable network applications.
你得发一个能稳定重现这个问题的代码示例
在linux 的容器里跑的 报错的是心跳
数据库配置文件新增2个配置 还在观察是否还会报错