1、问题:线上用docker部署了两个egg实例服务,其中一台会出现以下错误,另外一台正常 报错频率:不定时的出现 查看错误日志 并没有业务错误 暂时找不到复现规律 版本如下: node版本:v8.9.4 “cross-env”: “^5.2.0”, “crypto”: “^1.0.1”, “egg”: “^2.2.1”, “egg-cors”: “^2.1.0”, “egg-mongoose”: “^2.2.1”, “egg-router-plus”: “^1.2.2”, “egg-scripts”: “^2.5.0”, “egg-session-mongo”: “^2.0.0”, “egg-socket.io”: “^4.1.1”, “egg-validate”: “^2.0.0”, scripts": { “build”: “cross-env EGG_SERVER_ENV=prod egg-scripts start --title=ad-service --sticky”, “stop”: “egg-scripts stop --title=egg-server-example”, “dev”: “egg-bin dev --sticky”, “debug”: “egg-bin debug”, “test”: “cross-env EGG_SERVER_ENV=test egg-scripts start --sticky”, “test-local”: “egg-bin test”, “cov”: “egg-bin cov”, “lint”: “eslint .”, “ci”: “npm run lint && npm run cov”, “autod”: “autod” },
[Mon Jan 14 2019 16:50:31 GMT+0800 (CST)] [graceful:worker:56:uncaughtException] throw error 1 times
{ ECONNRESETError: read ECONNRESET (uncaughtException throw 1 times on pid:56)
at _errnoException (util.js:1022:11)
at TCP.onread (net.js:615:25)
code: 'ECONNRESET',
errno: 'ECONNRESET',
syscall: 'read',
name: 'ECONNRESETError' }
ECONNRESETError: read ECONNRESET (uncaughtException throw 1 times on pid:56)
at _errnoException (util.js:1022:11)
at TCP.onread (net.js:615:25)
[Mon Jan 14 2019 16:50:31 GMT+0800 (CST)] [graceful:worker:56] will exit after 30000ms
[Mon Jan 14 2019 16:50:31 GMT+0800 (CST)] [graceful:worker:56] close server#0, _connections: 0
[Mon Jan 14 2019 16:50:31 GMT+0800 (CST)] [graceful:worker:56] close 1 servers!
[Mon Jan 14 2019 16:50:31 GMT+0800 (CST)] [graceful:worker:56] worker disconnect!
[2019-01-14 16:50:31.429] [cfork:master:35] worker:56 disconnect (exitedAfterDisconnect: true, state: disconnected, isDead: false, worker.disableRefork: false)
[2019-01-14 16:50:31.431] [cfork:master:35] new worker:268 fork (state: none)
2019-01-14 16:50:31,431 INFO 35 [master] app_worker#2:56 disconnect, suicide: true, state: disconnected, current workers: ["1","2","3","5","6"]
2019-01-14 16:50:31,432 INFO 35 [master] app_worker#6:268 start, state: none, current workers: ["1","2","3","5","6"]
2019-01-14 16:50:31,771 INFO 268 Plugin development is disabled by env unmatched, require env(local) but got env is prod
2019-01-14 16:50:31,787 INFO 268 [egg:core] App root: /home/project
2019-01-14 16:50:31,788 INFO 268 [egg:core] All *.log files save on "/root/logs/"
然后 报这个错
2019-01-14 16:50:32,783 INFO 268 [egg:core:ready_stat] end ready task /home/project/node_modules/egg-watcher/lib/init.js:15:14, remain []
2019-01-14 16:50:32,806 INFO 35 [master] app_worker#6:268 started at 3737, remain 0 (887692202ms)
[2019-01-14 16:50:42.973] [cfork:master:35] master uncaughtException: Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
at ChildProcess.target.send (internal/child_process.js:588:16)
at Worker.send (internal/cluster/worker.js:54:28)
at Server.require.createServer.connection (/home/project/node_modules/egg-cluster/lib/master.js:164:16)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1561:8)
Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
at ChildProcess.target.send (internal/child_process.js:588:16)
at Worker.send (internal/cluster/worker.js:54:28)
at Server.require.createServer.connection (/home/project/node_modules/egg-cluster/lib/master.js:164:16)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1561:8)
(total 2 disconnect, 0 unexpected exit)
[2019-01-14 16:50:52.691] [cfork:master:35] master uncaughtException: Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
at ChildProcess.target.send (internal/child_process.js:588:16)
at Worker.send (internal/cluster/worker.js:54:28)
at Server.require.createServer.connection (/home/project/node_modules/egg-cluster/lib/master.js:164:16)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1561:8)
Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
at ChildProcess.target.send (internal/child_process.js:588:16)
at Worker.send (internal/cluster/worker.js:54:28)
at Server.require.createServer.connection (/home/project/node_modules/egg-cluster/lib/master.js:164:16)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
at TCP.onconnection (net.js:1561:8)
(total 2 disconnect, 0 unexpected exit)
[Mon Jan 14 2019 16:51:01 GMT+0800 (CST)] [graceful:worker:56] kill timeout, exit now.
2019-01-14 16:51:01,438 ERROR 56 [app_worker] exit with code:1
[2019-01-14 16:51:01.446] [cfork:master:35] worker:56 exit (code: 1, exitedAfterDisconnect: true, state: dead, isDead: true, isExpected: true, worker.disableRefork: false)
2019-01-14 16:51:01,446 ERROR 35 nodejs.AppWorkerDiedError: [master] app_worker#2:56 died (code: 1, signal: null, suicide: true, state: dead), current workers: ["1","3","5","6"]
at Master.onAppExit (/home/project/node_modules/egg-cluster/lib/master.js:398:21)
at emitOne (events.js:116:13)
at Master.emit (events.js:211:7)
at Messenger.sendToMaster (/home/project/node_modules/egg-cluster/lib/utils/messenger.js:137:17)
at Messenger.send (/home/project/node_modules/egg-cluster/lib/utils/messenger.js:102:12)
at EventEmitter.cluster.on (/home/project/node_modules/egg-cluster/lib/master.js:267:22)
at emitThree (events.js:141:20)
at EventEmitter.emit (events.js:217:7)
at ChildProcess.worker.process.once (internal/cluster/master.js:185:13)
at Object.onceWrapper (events.js:317:30)
name: "AppWorkerDiedError"
pid: 35
有大佬能帮忙看看吗 求助啊
会不会是容器(网络)异常导致的连接异常?
@waitingsong 多谢回答 可是怎么排查 容器网络异常呢?
这个就不清楚了。 可以试试看容器内 /var/log/ 目录下相关日志,或者宿主机 docker 的相关日志。