这里详细描述问题
try {
Gateway::sendToGroup($group_id, json_encode($send));
}catch (Throwable $e)
{
LogSave::logError($e,'wsSendReadyListRefresh-推送错误');
}
{"error":"Gateway::getAllGatewayAddressesFromRegister() with registerAddress:\"127.0.0.1:1236\" return array (
)","file":"/www/wwwroot/webman/vendor/workerman/gateway-worker/src/Lib/Gateway.php","line":1366,"trace":"#0 /www/wwwroot/webman/vendor/workerman/gateway-worker/src/Lib/Gateway.php(1261): GatewayWorker\\Lib\\Gateway::getAllGatewayAddressesFromRegister()
#1 /www/wwwroot/webman/vendor/workerman/gateway-worker/src/Lib/Gateway.php(1014): GatewayWorker\\Lib\\Gateway::sendToAllGateway()
#2 /www/wwwroot/webman/app/functions.php(163): GatewayWorker\\Lib\\Gateway::sendToGroup()
#3 /www/wwwroot/webman/app/api/controller/IndexController.php(1811): wsSendReadyListRefresh()
#4 /www/wwwroot/webman/vendor/workerman/webman-framework/src/App.php(319): app\\api\\controller\\IndexController->room_ready()
#5 /www/wwwroot/webman/vendor/workerman/webman-framework/src/App.php(349): Webman\\App::Webman\\{closure}()
#6 /www/wwwroot/webman/app/middleware/ChatToken.php(36): Webman\\App::Webman\\{closure}()
#7 /www/wwwroot/webman/vendor/workerman/webman-framework/src/App.php(341): app\\middleware\\ChatToken->process()
#8 /www/wwwroot/webman/vendor/webman/log/src/Middleware.php(96): Webman\\App::Webman\\{closure}()
#9 /www/wwwroot/webman/vendor/workerman/webman-framework/src/App.php(341): Webman\\Log\\Middleware->process()
#10 /www/wwwroot/webman/vendor/workerman/webman-framework/src/App.php(168): Webman\\App::Webman\\{closure}()
#11 /www/wwwroot/webman/vendor/workerman/workerman/Connection/TcpConnection.php(646): Webman\\App->onMessage()
#12 [internal function]: Workerman\\Connection\\TcpConnection->baseRead()
#13 /www/wwwroot/webman/vendor/workerman/workerman/Events/Event.php(193): EventBase->loop()
#14 /www/wwwroot/webman/vendor/workerman/workerman/Worker.php(1638): Workerman\\Events\\Event->loop()
#15 /www/wwwroot/webman/vendor/workerman/workerman/Worker.php(1429): Workerman\\Worker::forkOneWorkerForLinux()
#16 /www/wwwroot/webman/vendor/workerman/workerman/Worker.php(1403): Workerman\\Worker::forkWorkersForLinux()
#17 /www/wwwroot/webman/vendor/workerman/workerman/Worker.php(1788): Workerman\\Worker::forkWorkers()
#18 /www/wwwroot/webman/vendor/workerman/workerman/Worker.php(1724): Workerman\\Worker::monitorWorkersForLinux()
#19 /www/wwwroot/webman/vendor/workerman/workerman/Worker.php(562): Workerman\\Worker::monitorWorkers()
#20 /www/wwwroot/webman/vendor/workerman/webman-framework/src/support/App.php(131): Workerman\\Worker::runAll()
#21 /www/wwwroot/webman/start.php(4): support\\App::run()
从报错看是gatewayWorker内部的连接还没建立好,业务就开始调用gatewayWorker的服务导致的。
执行 ps auxf 看下是不是有多余的register进程,register进程进程只有一个才对。
root 1819282 0.0 0.4 94180 17464 ? S Mar15 0:25 WorkerMan: master process start_file=/www/wwwroot/911backend/start.php
root 1819291 0.0 0.6 98412 24268 ? S Mar15 0:21 _ WorkerMan: worker process monitor none
root 1819345 0.0 1.2 120940 47332 ? S Mar15 13:49 _ WorkerMan: worker process plugin.webman.gateway-worker.gateway websocket://0.0.0.0:16477
root 1819352 0.0 1.3 122988 49380 ? S Mar15 15:14 _ WorkerMan: worker process plugin.webman.gateway-worker.gateway websocket://0.0.0.0:16477
root 2078289 0.0 0.7 100496 27508 ? S Mar28 0:01 _ WorkerMan: worker process pk_accept none
root 2078293 0.0 0.7 100496 26972 ? S Mar28 0:05 _ WorkerMan: worker process pk_disband none
root 2078294 0.0 0.7 100496 27620 ? S Mar28 0:06 _ WorkerMan: worker process pk_playing none
root 2078296 0.0 0.7 100496 27612 ? S Mar28 0:05 _ WorkerMan: worker process pk_settlement none
root 2078297 0.0 0.7 100496 27088 ? S Mar28 0:01 _ WorkerMan: worker process gold_shop_check none
root 2078298 0.0 0.6 98412 24748 ? S Mar28 0:00 _ WorkerMan: worker process arenaof_valor none
root 2078323 0.0 0.6 98412 24368 ? S Mar28 0:00 _ WorkerMan: worker process redis_key_expired none
root 2078327 0.4 0.8 104596 31520 ? S Mar28 4:32 _ WorkerMan: worker process finan_data none
root 2078328 0.0 0.8 102764 30212 ? S Mar28 0:00 _ WorkerMan: worker process tron_usdt none
root 2078329 0.0 0.6 98412 24768 ? S Mar28 0:03 _ WorkerMan: worker process tron_with none
root 2078330 0.0 0.7 100496 26432 ? S Mar28 0:03 _ WorkerMan: worker process auto_open_room none
root 2078333 0.0 0.8 104596 32188 ? S Mar28 0:14 _ WorkerMan: worker process auto_start_game none
root 2078336 0.0 0.7 100496 26956 ? S Mar28 0:00 _ WorkerMan: worker process stop_point_game none
root 2078339 0.0 0.6 98412 24384 ? S Mar28 0:00 _ WorkerMan: worker process create_100_point_room none
root 2078353 0.1 2.0 145188 75148 ? S Mar28 1:38 _ WorkerMan: worker process plugin.webman.gateway-worker.worker none
root 2078357 0.1 1.9 143920 71380 ? S Mar28 1:26 _ WorkerMan: worker process plugin.webman.gateway-worker.worker none
root 2078362 0.1 2.0 145052 75104 ? S Mar28 1:43 _ WorkerMan: worker process plugin.webman.gateway-worker.worker none
root 2078366 0.1 2.0 145184 75048 ? S Mar28 1:24 _ WorkerMan: worker process plugin.webman.gateway-worker.worker none
root 2078367 0.0 0.6 98412 24400 ? S Mar28 0:02 _ WorkerMan: worker process plugin.webman.gateway-worker.register text://0.0.0.0:1236
root 2078368 0.0 0.6 98436 24532 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_refund none
root 2078369 0.0 0.6 98436 24636 ? S Mar28 0:14 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_refund none
root 2078370 0.0 0.6 98436 24404 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_refund none
root 2078371 0.0 0.6 98436 24640 ? S Mar28 0:12 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_refund none
root 2078372 0.0 0.6 98436 24532 ? S Mar28 0:10 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_refund none
root 2078374 0.0 0.6 98436 24640 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_settlement none
root 2078375 0.0 0.6 98436 24404 ? S Mar28 0:10 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_settlement none
root 2078376 0.0 0.6 98436 24632 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_settlement none
root 2078379 0.0 0.6 98436 24660 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_settlement none
root 2078381 0.0 0.6 98436 24404 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.wz_room_settlement none
root 2078382 0.0 0.6 98436 24524 ? S Mar28 0:10 _ WorkerMan: worker process plugin.webman.redis-queue.private_chat_server none
root 2078384 0.0 0.6 98436 24632 ? S Mar28 0:10 _ WorkerMan: worker process plugin.webman.redis-queue.group_chat_server none
root 2078388 0.0 0.7 102548 29280 ? S Mar28 0:15 _ WorkerMan: worker process plugin.webman.redis-queue.group_message_server none
root 2078390 0.0 0.6 98436 25156 ? S Mar28 0:11 _ WorkerMan: worker process plugin.webman.redis-queue.private_message_server none
root 2078399 0.0 0.8 102532 29700 ? S Mar28 0:52 _ WorkerMan: worker process plugin.webman.redis-queue.group_chat_red_msg none
root 2078407 0.0 1.0 110852 38132 ? S Mar28 0:47 _ WorkerMan: worker process plugin.webman.redis-queue.group_chat_update_user none
root 2078417 0.0 0.7 100688 28032 ? S Mar28 0:10 _ WorkerMan: worker process plugin.webman.redis-queue.usdt_trans_query none
root 2078422 0.0 0.6 98436 24640 ? S Mar28 0:10 _ WorkerMan: worker process plugin.webman.redis-queue.group_nine_grid_img none
root 2091947 0.1 1.1 113124 43556 ? S 15:42 0:03 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092157 0.2 1.0 110976 39748 ? S 15:53 0:02 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092331 0.1 0.9 108692 36328 ? S 16:02 0:01 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092413 0.2 0.8 104596 32016 ? S 16:06 0:00 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092428 0.3 2.0 146880 75760 ? S 16:07 0:00 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092431 0.4 1.2 117244 47728 ? S 16:07 0:01 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092520 1.6 3.8 214036 141180 ? S 16:09 0:01 _ WorkerMan: worker process webman http://0.0.0.0:16471
root 2092524 1.5 3.7 212000 139216 ? S 16:09 0:01 _ WorkerMan: worker process webman http://0.0.0.0:16471
register好像确实只有一个
继续监控