webman redis/queue 消费者偶尔出现数据库操作超时

ixlara

问题描述

队列消费者偶尔出现数据库操作超时
"error":"PDOException: SQLSTATE[HY000] [2002] Operation timed out

我看了数据库信息,基本参数状态都还好,之前项目也一直在正常运行。
这个报错不是一直出现,过十国分钟出现一次这种频率,实在找不到问题所在了

报错信息

{"id":"16824926201035853807","time":1682492620,"delay":0,"attempts":4,"queue":"station_release_queue","data":{"id":62904277,"customer_number":1010007150,"account_id":47217,"account_type":2,"parent_account_id":47217,"parent_account_type":2,"son_account_id":45358,"son_account_type":2,"is_internal":0,"category":3,"rel_id":63565509,"card_tag":2,"order_id":25083070,"money":121820,"type":1,"mal_id":25305134,"mal_money":3000000,"mal_create_time":"2023-04-20 15:52:28","source":8,"cr_id":0,"create_time":"2023-04-26 14:59:36","ocreate_time":"2023-04-26 14:56:59","receipt_fuel_name":null,"receipt_fuel_price":null,"fuel_type":4},"error":"PDOException: SQLSTATE[HY000] [2002] Operation timed out in \/app\/vendor\/illuminate\/database\/Connectors\/Connector.php:70\nStack trace:\n#0 \/app\/vendor\/illuminate\/database\/Connectors\/Connector.php(70): PDO->__construct('mysql:host=host.', 'collection_prod', password.', Array)\n#1 \/app\/vendor\/illuminate\/database\/Connectors\/Connector.php(46): Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=pc-2...', 'username', 'ADvsyuCF7U28rB6...', Array)\n#2 \/app\/vendor\/illuminate\/database\/Connectors\/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection('mysql:host=pc-2...', Array, Array)\n#3 \/app\/vendor\/illuminate\/database\/Connectors\/ConnectionFactory.php(184): Illuminate\\Database\\Connectors\\MySqlConnector->connect(Array)\n#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()\n#5 \/app\/vendor\/illuminate\/database\/Connection.php(1062): call_user_func(Object(Closure))\n#6 \/app\/vendor\/illuminate\/database\/Connection.php(1098): Illuminate\\Database\\Connection->getPdo()\n#7 \/app\/vendor\/illuminate\/database\/Connection.php(442): Illuminate\\Database\\Connection->getReadPdo()\n#8 \/app\/vendor\/illuminate\/database\/Connection.php(368): Illuminate\\Database\\Connection->getPdoForSelect(true)\n#9 \/app\/vendor\/illuminate\/database\/Connection.php(705): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('select * from `...', Array)\n#10 \/app\/vendor\/illuminate\/database\/Connection.php(672): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))\n#11 \/app\/vendor\/illuminate\/database\/Connection.php(376): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))\n#12 \/app\/vendor\/illuminate\/database\/Query\/Builder.php(2414): Illuminate\\Database\\Connection->select('select * from `...', Array, true)\n#13 \/app\/vendor\/illuminate\/database\/Query\/Builder.php(2402): Illuminate\\Database\\Query\\Builder->runSelect()\n#14 \/app\/vendor\/illuminate\/database\/Query\/Builder.php(2936): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()\n#15 \/app\/vendor\/illuminate\/database\/Query\/Builder.php(2403): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))\n#16 \/app\/vendor\/illuminate\/database\/Eloquent\/Builder.php(625): Illuminate\\Database\\Query\\Builder->get(Array)\n#17 \/app\/vendor\/illuminate\/database\/Eloquent\/Builder.php(609): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)\n#18 \/app\/vendor\/illuminate\/database\/Concerns\/BuildsQueries.php(294): Illuminate\\Database\\Eloquent\\Builder->get(Array)\n#19 \/app\/app\/queue\/redis\/StationReleaseConsume.php(107): Illuminate\\Database\\Eloquent\\Builder->first()\n#20 \/app\/app\/queue\/redis\/StationReleaseConsume.php(33): app\\queue\\redis\\StationReleaseConsume->getMemberOrderInfo(25083070)\n#21 \/app\/vendor\/workerman\/redis-queue\/src\/Client.php(218): app\\queue\\redis\\StationReleaseConsume->consume(Array)\n#22 \/app\/vendor\/workerman\/redis\/src\/Client.php(415): Workerman\\RedisQueue\\Client->Workerman\\RedisQueue\\{closure}(Array, Object(Workerman\\Redis\\Client))\n#23 \/app\/vendor\/workerman\/workerman\/Connection\/TcpConnection.php(638): Workerman\\Redis\\Client->Workerman\\Redis\\{closure}(Object(Workerman\\Connection\\AsyncTcpConnection), Array)\n#24 [internal function]: Workerman\\Connection\\TcpConnection->baseRead(Resource id #83741, 2, Resource id #83741)\n#25 \/app\/vendor\/workerman\/workerman\/Events\/Event.php(193): EventBase->loop()\n#26 \/app\/vendor\/workerman\/workerman\/Worker.php(2431): Workerman\\Events\\Event->loop()\n#27 \/app\/vendor\/workerman\/workerman\/Worker.php(1555): Workerman\\Worker->run()\n#28 \/app\/vendor\/workerman\/workerman\/Worker.php(1397): Workerman\\Worker::forkOneWorkerForLinux(Object(Workerman\\Worker))\n#29 \/app\/vendor\/workerman\/workerman\/Worker.php(1371): Workerman\\Worker::forkWorkersForLinux()\n#30 \/app\/vendor\/workerman\/workerman\/Worker.ph

操作系统及workerman/webman等框架组件具体版本

docker

870 3 0
3个回答

tanhongbin

你是不是没有开启 mysql 的心跳?你用的是哪个框架的 orm?laravel是在这里 开启截图

  • ixlara 2023-04-26

    已经开启了啊,而且之前是正常的,就最近出现了这个问题

  • tanhongbin 2023-04-26

    没遇到过这个问题

智佳思远

2002 是连接数据库超时,检查数据配置。

  • ixlara 2023-04-26

    数据库配置没啥问题,这个报错不是必现的,有些数据就能消费成功

  • 智佳思远 2023-04-26

    截图
    看下数据库host对不对

army

我也有这种情况,偶发性的,只要出现一次就会时不时的来一次,但是我发现stop后重新start如果不会出现就能一直正常,如果还是会有又重复stop就能解决,不知道是不是PHP的bug,我的PHP版本是8.1.12

  • 暂无评论
年代过于久远,无法发表回答
×
🔝