国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

wokerman后臺運(yùn)行后,停止和查狀態(tài)報錯

robin2024

問題描述

1、在putty上直接前端啟動,php start.php start;一切正常,使用control + C 關(guān)閉也正常。
2、在putty上啟動后臺運(yùn)行,php start.php start -D;啟動正常,執(zhí)行php start.php status或者 stop ,都匯報 監(jiān)聽的端口已被占用的錯誤。
3、在前臺運(yùn)行的情況下,在woker的onmessage 中讀取msql正常。
在后臺運(yùn)行的情況下,在woker的onmessage 中讀取msql異常。
msql句柄在woker的onstart 中創(chuàng)建。

報錯信息

stream_socket_server(): unable to connect to tcp://0.0.0.0:5678 (Address already in use)

操作系統(tǒng)及workerman/webman等框架組件具體版本

當(dāng)前環(huán)境,ubuntu18、wokerman 最新版本,php8.0,mysql3.7

1613 4 0
4個回答

walkor 打賞

根據(jù)描述2應(yīng)該是主進(jìn)程退出了,退出的原因可能是你在啟動腳本里進(jìn)行了一些邏輯處理產(chǎn)生了錯誤導(dǎo)致進(jìn)程退出。
不要在啟動腳本直接寫業(yè)務(wù)邏輯,業(yè)務(wù)邏輯放到onXXX回調(diào)里寫。

根據(jù)描述3的現(xiàn)象來判斷,還是你在啟動腳本里直接初始化了數(shù)據(jù)庫連接或者其他連接資源,數(shù)據(jù)庫、redis等應(yīng)該在onXX回調(diào)里初始化。啟動腳本里直接初始化數(shù)據(jù)庫或者redis等資源,子進(jìn)程會繼承這些資源,導(dǎo)致互相收到影響。

看下workerman.log日志,日志沒有明確內(nèi)容時打開php.ini中的error_log,看error_log的日志。
或者將業(yè)務(wù)代碼一半一半的注釋掉,直到找到問題因為問題的代碼。

robin2024

1、從新在后臺運(yùn)行,看起來workerman的各進(jìn)程應(yīng)該都正常啊,

2、執(zhí)行 status查詢還是有錯誤
PHP Warning: stream_socket_server(): Unable to connect to tcp://0.0.0.0:6569 (Address already in use) in /home/forex/forex-v3/vendor/workerman/workerman/Worker.php on line 2360

Warning: stream_socket_server(): Unable to connect to tcp://0.0.0.0:6569 (Address already in use) in /home/forex/forex-v3/vendor/workerman/workerman/Worker.php on line 2360
PHP Fatal error: Uncaught Exception: Address already in use in /home/forex/forex-v3/vendor/workerman/workerman/Worker.php:2362
Stack trace:

0 /home/forex/forex-v3/Applications/forex/start_forex.php(95): Workerman\Worker->listen()

1 /home/forex/forex-v3/start.php(29): require_once('...')

2 {main}

thrown in /home/forex/forex-v3/vendor/workerman/workerman/Worker.php on line 2362

Fatal error: Uncaught Exception: Address already in use in /home/forex/forex-v3/vendor/workerman/workerman/Worker.php:2362
Stack trace:

0 /home/forex/forex-v3/Applications/forex/start_forex.php(95): Workerman\Worker->listen()

1 /home/forex/forex-v3/start.php(29): require_once('...')

2 {main}

thrown in /home/forex/forex-v3/vendor/workerman/workerman/Worker.php on line 2362

  • robin2024 2023-12-08

    補(bǔ)充一點(diǎn),workerman.log 沒有錯誤信息

walkor 打賞

發(fā)一個能重現(xiàn)你這個問題的啟動文件 start.php,不要任何業(yè)務(wù)邏輯。注意,要能重現(xiàn)你這個問題的start.php,完整的啟動文件,別人能運(yùn)行測試的。

  • 暫無評論
robin2024

找到原因了,因為此前使用workerman的老版本,
創(chuàng)建worker后,會執(zhí)行 $worker->listen(); 命令,在老版本沒問題。
在新版本上執(zhí)行 $worker->listen();命令會導(dǎo)致端口被占用的錯誤。

出現(xiàn)這種錯誤,耽誤了1天時間,真是讓人苦笑不得

  • robin2024 2023-12-09

    不錯,在找問題過程中對workerman理解更深入了一些,
    順便看了很牛X的 workerman AI

年代過于久遠(yuǎn),無法發(fā)表回答
??