您好,請(qǐng)教一個(gè)問題:
?
部署情況:
GatewayWorker的Register?Gateway BusinessWorker全部是分開部署,分別啟動(dòng)的。全部在部署是一臺(tái)本機(jī)上。
?
問題描述:
我的BusinessWorker過一段時(shí)間不執(zhí)行任務(wù)會(huì)跟Gateway斷開,無法執(zhí)行后臺(tái)任務(wù)。具體間隔的時(shí)長不太清楚,一般是隔一個(gè)晚上,第二天執(zhí)行異步任務(wù),就無法執(zhí)行,必須Reload就可以再次執(zhí)行了。只有一直有任務(wù)執(zhí)行就不會(huì)出現(xiàn)斷開的情況。
?
日志截圖:
==> workerman.log <==
2019-02-15 23:07:25 pid:13913 Workerman stop success
2019-02-15 23:07:26 pid:12583 SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready. See http://wiki.workerman.net/Error3
2019-02-15 23:07:26 pid:12583 SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready. See http://wiki.workerman.net/Error3
2019-02-15 23:38:32 pid:13913 Workerman stopping ...
2019-02-15 23:38:32 pid:13913 Workerman has been stopped
2019-02-15 23:38:34 pid:13994 Workerman restart
2019-02-15 23:38:34 pid:13994 Workerman is stopping ...
2019-02-15 23:38:34 pid:13994 Workerman stop success
2019-02-16 08:35:34 pid:16411 Workerman reload
2019-02-16 08:35:34 pid:13997 Workerman reloading
您好 Walkor
今天早上Businessworker依舊不執(zhí)行(這個(gè)問題,我去年就碰到,當(dāng)時(shí)只能用linux定時(shí)任務(wù)做Reload)
我確定沒有做任何外部接口調(diào)用,因?yàn)橄掳胍箾]有任何業(yè)務(wù)執(zhí)行,感謝您的再次回復(fù)!
?
補(bǔ)充一下我用的是系統(tǒng)環(huán)境?CentOS Linux release 7.4.1708 (Core)? ?64位
Status信息如下:(以下信息是沒有做Reload之前的信息截圖)Workerman status
----------------------------------------------GLOBAL STATUS----------------------------------------------------
Workerman version:3.5.14 PHP version:7.2.12
start time:2019-02-16 22:09:03 run 0 days 10 hours
load average: 8.87, 9, 9 event-loop:\Workerman\Events\Event
2 workers 11 processes
worker_name exit_status exit_count
FileMonitor 0 0
commonBusinessworker 0 0
----------------------------------------------PROCESS STATUS---------------------------------------------------
pid memory listening worker_name connections send_fail timers total_request qps status
10845 2M none FileMonitor 0 0 0 0 0
10846 4M none commonBusinessworker 5 0 0 10 0
10847 4M none commonBusinessworker 5 0 0 4 0
10848 4M none commonBusinessworker 5 0 0 1 0
10849 4M none commonBusinessworker 5 0 0 4 0
10850 4M none commonBusinessworker 5 0 0 101 0
10851 4M none commonBusinessworker 5 0 0 6 0
10852 4M none commonBusinessworker 5 0 0 16 0
10853 4M none commonBusinessworker 5 0 0 1 0
10854 4M none commonBusinessworker 5 0 0 7 0
10855 4M none commonBusinessworker 5 0 0 1 0
----------------------------------------------PROCESS STATUS---------------------------------------------------
Summary 42M - - 50 0 0 151 0 上面Status截圖之后,我Reload一下,異步任務(wù)就立刻有效執(zhí)行,日志詳情如下:
2019-02-16 20:34:50 pid:10680 Workerman stopping ...
2019-02-16 20:34:50 pid:10680 Workerman has been stopped
2019-02-16 20:34:50 pid:10692 Workerman stop success
2019-02-16 20:35:42 pid:10707 Workerman status
2019-02-16 20:36:00 pid:10708 Workerman status
2019-02-16 20:36:23 pid:10710 Workerman status
2019-02-16 21:18:33 pid:10771 Workerman status
2019-02-16 21:19:25 pid:10774 Workerman status
2019-02-16 22:09:03 pid:10842 Workerman restart
2019-02-16 22:09:03 pid:10842 Workerman is stopping ...
2019-02-16 22:09:03 pid:10694 Workerman stopping ...
2019-02-16 22:09:03 pid:10694 Workerman has been stopped
2019-02-16 22:09:03 pid:10842 Workerman stop success
2019-02-16 22:09:19 pid:10856 Workerman status
2019-02-17 08:18:32 pid:13297 Workerman status
2019-02-17 08:26:18 pid:13451 Workerman reload
2019-02-17 08:26:18 pid:10844 Workerman reloading
從status里看BusinessWorker看是開了4個(gè)Gateway進(jìn)程,如果是4個(gè)Gateway進(jìn)程那么BusinessWorker看起來status是正常的。但是服務(wù)器的負(fù)載看起來有點(diǎn)高,top看下是什么進(jìn)程造成這么高的負(fù)載。
?還有分部署部署的示意圖貼下,哪些ip放了哪些服務(wù),每個(gè)服務(wù)的配置貼下。另外描述下具體的業(yè)務(wù)是什么?
?
BusinessWorker過一段時(shí)間不執(zhí)行任務(wù)會(huì)跟Gateway斷開
怎么知道的BusinessWorker與Gateway 斷開了?
?
無法執(zhí)行后臺(tái)任務(wù)
什么異步任務(wù)?如何確定的無法執(zhí)行后臺(tái)任務(wù)?還有能否貼下Events.php代碼?
?
?
經(jīng)過一段時(shí)間的排查和觀察,之所以不執(zhí)行任務(wù),是出在Redis和Mysql的自動(dòng)斷開的原因,他們的引用寫在onWorkerStart里。后來改掉了就好了
感謝大大的及時(shí)回復(fù)!