Open heiyanshooter opened 6 years ago
I've a similar issue, I use systemctl service to run my robot, it goes wrong after several days, below is my systemctl error log:
Sep 26 06:22:22 babits-dev start.sh[554]: 06:22:22 WARN PuppetPuppeteer initScanWatchdog() on(reset) lastFood: https://login.weixin.qq.com/l/4bK8YEsqQA==, timePast: 120000
Sep 26 06:24:49 babits-dev start.sh[554]: 06:24:49 WARN PuppetPuppeteer initScanWatchdog() on(reset) lastFood: https://login.weixin.qq.com/l/gch055ZQkw==, timePast: 120000
Sep 26 06:27:16 babits-dev start.sh[554]: 06:27:16 WARN PuppetPuppeteer initScanWatchdog() on(reset) lastFood: https://login.weixin.qq.com/l/weEtk0chrw==, timePast: 120000
Sep 26 06:27:46 babits-dev start.sh[554]: 06:27:46 ERR PuppetPuppeteer initScanWatchdog() on(reset) exception: TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded
Sep 26 06:27:46 babits-dev start.sh[554]: 06:27:46 ERR PuppetPuppeteer initScanWatchdog() on(reset) try to recover by bridge.{quit,init}()
Sep 26 06:27:55 babits-dev start.sh[554]: 06:27:55 ERR PuppetPuppeteerBridge onLoad() exception: Error: Failed to add page binding with name wechatyPuppetBridgeEmit: window['wechatyPuppetBridgeEmit'] already exists!
Sep 26 06:27:55 babits-dev start.sh[554]: 06:27:55 ERR PuppetPuppeteerBridge onLoad() exception: Error: Protocol error (Page.addScriptToEvaluateOnNewDocument): Target closed.
Sep 26 06:27:55 babits-dev start.sh[554]: (node:561) UnhandledPromiseRejectionWarning: Error: Protocol error: Connection closed. Most likely the page has been closed.
Sep 26 06:27:55 babits-dev start.sh[554]: at assert (/root/wechaty-cc-monitor/node_modules/puppeteer/lib/helper.js:270:11)
Sep 26 06:27:55 babits-dev start.sh[554]: at Page.close (/root/wechaty-cc-monitor/node_modules/puppeteer/lib/Page.js:956:5)
Sep 26 06:27:55 babits-dev start.sh[554]: at Bridge.<anonymous> (/root/wechaty-cc-monitor/node_modules/wechaty-puppet-puppeteer/dist/src/bridge.js:146:28)
Sep 26 06:27:55 babits-dev start.sh[554]: at Generator.throw (<anonymous>)
Sep 26 06:27:55 babits-dev start.sh[554]: at rejected (/root/wechaty-cc-monitor/node_modules/wechaty-puppet-puppeteer/dist/src/bridge.js:24:65)
Sep 26 06:27:55 babits-dev start.sh[554]: at <anonymous>
Sep 26 06:27:55 babits-dev start.sh[554]: at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Sep 26 06:27:55 babits-dev start.sh[554]: (node:561) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
Sep 26 06:27:55 babits-dev start.sh[554]: (node:561) UnhandledPromiseRejectionWarning: Error: Error: Failed to add page binding with name wechatyPuppetBridgeEmit: window['wechatyPuppetBridgeEmit'] already exists!
Sep 26 06:27:55 babits-dev start.sh[554]: at PuppetPuppeteer.puppet.on.error (/root/wechaty-cc-monitor/node_modules/wechaty/dist/src/wechaty.js:436:44)
Sep 26 06:27:55 babits-dev start.sh[554]: at emitOne (events.js:116:13)
Sep 26 06:27:55 babits-dev start.sh[554]: at PuppetPuppeteer.emit (events.js:211:7)
Sep 26 06:27:55 babits-dev start.sh[554]: at PuppetPuppeteer.emit (/root/wechaty-cc-monitor/node_modules/wechaty-puppet/dist/src/puppet.js:171:22)
Sep 26 06:27:55 babits-dev start.sh[554]: at Bridge.bridge.on.e (/root/wechaty-cc-monitor/node_modules/wechaty-puppet-puppeteer/dist/src/puppet-puppeteer.js:207:47)
Sep 26 06:27:55 babits-dev start.sh[554]: at emitOne (events.js:116:13)
Sep 26 06:27:55 babits-dev start.sh[554]: at Bridge.emit (events.js:211:7)
Sep 26 06:27:55 babits-dev start.sh[554]: at Bridge.<anonymous> (/root/wechaty-cc-monitor/node_modules/wechaty-puppet-puppeteer/dist/src/bridge.js:147:22)
Sep 26 06:27:55 babits-dev start.sh[554]: at Generator.next (<anonymous>)
Sep 26 06:27:55 babits-dev start.sh[554]: at fulfilled (/root/wechaty-cc-monitor/node_modules/wechaty-puppet-puppeteer/dist/src/bridge.js:23:58)
Sep 26 06:27:55 babits-dev start.sh[554]: at <anonymous>
Sep 26 06:27:55 babits-dev start.sh[554]: at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Sep 26 06:27:55 babits-dev start.sh[554]: (node:561) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
Sep 26 06:28:05 babits-dev start.sh[554]: 06:28:05 WARN PuppetPuppeteerBridge stop() page.close() exception: Error: Protocol error: Connection closed. Most likely the page has been closed.
I think the original error is ERR PuppetPuppeteer initScanWatchdog() on(reset) exception: TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded
.
+1 TimeoutError: Navigation Timeout Exceeded
+1
04:07:53 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
27 | | 01-26 12:07:23 | (node:39) UnhandledPromiseRejectionWarning: Error: Error: Page crashed!
-- | -- | -- | --
28 | | 01-26 12:07:23 | at PuppetPuppeteer.puppet.on.error (/bot/node_modules/wechaty/src/wechaty.ts:600:32)
29 | | 01-26 12:07:23 | at PuppetPuppeteer.emit (events.js:182:13)
30 | | 01-26 12:07:23 | at PuppetPuppeteer.EventEmitter.emit (domain.js:442:20)
31 | | 01-26 12:07:23 | at PuppetPuppeteer.emit (/wechaty/node_modules/wechaty-puppet/src/puppet.ts:298:18)
32 | | 01-26 12:07:23 | at Bridge.bridge.on.e (/wechaty/node_modules/wechaty-puppet-puppeteer/src/puppet-puppeteer.ts:296:43)
33 | | 01-26 12:07:23 | at Bridge.emit (events.js:182:13)
34 | | 01-26 12:07:23 | at Bridge.EventEmitter.emit (domain.js:442:20)
35 | | 01-26 12:07:23 | at Page.page.on.e (/wechaty/node_modules/wechaty-puppet-puppeteer/src/bridge.ts:198:33)
36 | | 01-26 12:07:23 | at Page.emit (events.js:182:13)
37 | | 01-26 12:07:23 | at Page.EventEmitter.emit (domain.js:442:20)
38 | | 01-26 12:07:23 | at Page._onTargetCrashed (/wechaty/node_modules/puppeteer/lib/Page.js:175:10)
39 | | 01-26 12:07:23 | at CDPSession.Page.client.on.event (/wechaty/node_modules/puppeteer/lib/Page.js:137:56)
40 | | 01-26 12:07:23 | at CDPSession.emit (events.js:182:13)
41 | | 01-26 12:07:23 | at CDPSession.EventEmitter.emit (domain.js:442:20)
-- | -- | -- | --
42 | | 01-26 12:07:23 | at CDPSession._onMessage (/wechaty/node_modules/puppeteer/lib/Connection.js:216:12)
43 | | 01-26 12:07:23 | at Connection._onMessage (/wechaty/node_modules/puppeteer/lib/Connection.js:99:19)
44 | | 01-26 12:07:23 | at WebSocketTransport._ws.addEventListener.event (/wechaty/node_modules/puppeteer/lib/WebSocketTransport.js:41:24)
45 | | 01-26 12:07:23 | at WebSocket.onMessage (/wechaty/node_modules/puppeteer/node_modules/ws/lib/event-target.js:120:16)
46 | | 01-26 12:07:23 | at WebSocket.emit (events.js:182:13)
47 | | 01-26 12:07:23 | at WebSocket.EventEmitter.emit (domain.js:442:20)
48 | | 01-26 12:07:23 | at Receiver.receiverOnMessage (/wechaty/node_modules/puppeteer/node_modules/ws/lib/websocket.js:720:20)
49 | | 01-26 12:07:23 | at Receiver.emit (events.js:182:13)
50 | | 01-26 12:07:23 | at Receiver.EventEmitter.emit (domain.js:442:20)
51 | | 01-26 12:07:23 | at Receiver.dataMessage (/wechaty/node_modules/puppeteer/node_modules/ws/lib/receiver.js:414:14)
52 | | 01-26 12:07:23 | at Receiver.getData (/wechaty/node_modules/puppeteer/node_modules/ws/lib/receiver.js:346:17)
53 | | 01-26 12:07:23 | at Receiver.startLoop (/wechaty/node_modules/puppeteer/node_modules/ws/lib/receiver.js:133:22)
54 | | 01-26 12:07:23 | at Receiver._write (/wechaty/node_modules/puppeteer/node_modules/ws/lib/receiver.js:69:10)
55 | | 01-26 12:07:23 | at doWrite (_stream_writable.js:410:12)
56 | | 01-26 12:07:23 | at writeOrBuffer (_stream_writable.js:394:5)
57 | | 01-26 12:07:23 | at Receiver.Writable.write (_stream_writable.js:294:11)
58 | | 01-26 12:07:23 | at Socket.socketOnData (/wechaty/node_modules/puppeteer/node_modules/ws/lib/websocket.js:795:35)
59 | | 01-26 12:07:23 | at Socket.emit (events.js:182:13)
60 | | 01-26 12:07:23 | at Socket.EventEmitter.emit (domain.js:442:20)
61 | | 01-26 12:07:23 | at addChunk (_stream_readable.js:283:12)
-- | -- | -- | --
62 | | 01-26 12:07:23 | at readableAddChunk (_stream_readable.js:264:11)
63 | | 01-26 12:07:23 | at Socket.Readable.push (_stream_readable.js:219:10)
64 | | 01-26 12:07:23 | at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
65 | | 01-26 12:07:23 | (node:39) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5252)
-- | -- | -- | --
66 | | 01-26 12:07:52 | 04:07:52 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Target closed.
67 | | 01-26 12:07:52 | 04:07:52 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Target closed.
68 | | 01-26 12:07:52 | 04:07:52 ERR PuppetPuppeteerBridge contactList() exception: Protocol error (Runtime.callFunctionOn): Target closed.
69 | | 01-26 12:07:52 | 04:07:52 ERR Contact this.puppet.contactFindAll() rejected: Protocol error (Runtime.callFunctionOn): Target closed.
70 | | 01-26 12:07:52 | Bot Contact number: 0
71 | | 01-26 12:07:52 | Bot I will re-dump contact weixin id & names after 61 second...
72 | | 01-26 12:07:52 | 04:07:52 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
73 | | 01-26 12:07:53 | 04:07:53 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
74 | | 01-26 12:07:53 | 04:07:53 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
75 | | 01-26 12:07:53 | 04:07:53 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
76 | | 01-26 12:07:54 | 04:07:54 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
77 | | 01-26 12:07:59 | 04:07:59 WARN PuppetPuppeteerBridge proxyWechaty() noWechaty exception: Error: Execution context was destroyed, most likely because of a navigation.
--
+1 几小时后 17:47:54 WARN PuppetPuppeteerBridge stop() page.close() exception: Error: Protocol error: Connection closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@561421ee31f7d8dd904549b9554c2319e5415d24748ee52fdc1440b82bdf72e3) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@cef75d8e51a28e66c87449acaa64292d39f4e98f58257507f4ed18fab25db36c) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@794376aa9f0846b4b1f8c687785efc3df038ccbbe210942f73333eb4dfbd4155) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@4939dfd9a832fd543d7b8f2491351ca35aa0f09c5d069b0a91622cd4dc93962b) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@b35255477a9e299f93ba9bf342659e37a5bb094b7212d299a2b71b28928613f9) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@b9e103374ee2a5ace3f554137e45fce734aeeb45c138642f89a4715d409b9c00) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@c3b03630a74dbd81b8732fc024719a0294e42f0305a1cfabf8bf2bb4ad67cffc) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@b47c6884f09857c648a41c9e8e92667bad695a44d94c3a1db7ddace0c0ba526f) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@0f737e8b4b6412e94b43706eb1cd52f88c49f33d6ccf428fa6fbf3209337e24a) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@b42791112bb51d48374889284b52e21297b9fd2554d3ab202da6412fe7a9688c) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@6b636450c7f2f6a6c72edb52d535c650671455242b85aeea3d459cf11df12ca6) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@871ade8c9f3ccacf0000ab8081bd875af46cdb067503aea42199a1dce45af78f) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@632735ffce1a447490dab0d72a9d178786b43cf400b2de75d4e07f263dcc9863) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@64352a59baaf71628b5dedb2694c13f080cf46443aa6841ef5a712a31cf6749d) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@2125900bbb9ba46a264b62cb04c85fbf054095d0baa22a95091078f147d078ef) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@63247946b0c35679b77ea9feb08e7e756978fc106efec412f1c70ed705c50d05) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@983c5cf92be79ad3787df1a5a8344e962b77b3f3d4f469d99af2375c4b177997) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@a91839c4ef9cb2d9b040903c0b4ef8581d308a1ea465d739d0ab321f603dd436) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@232429f5dfa522636dbdfc512a6e15de116ec32650501111f8499d740cac456e) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@5c1d971e7192f622a9b4edb205839cde65dae59cef4e04c48d474b225cc18f17) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@b1bf0a45c371f150270ab429281313c11ed509109181b00633c0fdef0990c2c1) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@29a716187c78bad289645ca15b40b429) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer contactRawPayload(@8b51a1a7c0cb697eb24d4ab694b5a7afec8501ae9bcf5ead9972f99292ead72d) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer roomRawPayload(@@9fb522b72ca5520a3c6a347480a3d5faac54ca5cf52ad468f4ba7d9e5ac28ecf) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
13:46:40 ERR PuppetPuppeteer roomRawPayload(@@9fb522b72ca5520a3c6a347480a3d5faac54ca5cf52ad468f4ba7d9e5ac28ecf) exception: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
(node:12442) UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
at CDPSession.send (/root/nodeitem/wx_robot/node_modules/wechaty/node_modules/puppeteer/lib/Connection.js:180:29)
at ExecutionContext.evaluateHandle (/root/nodeitem/wx_robot/node_modules/wechaty/node_modules/puppeteer/lib/ExecutionContext.js:106:44)
at ExecutionContext.
I have the same issue. Does any one have a workaround or solution?
+1, any ideas now?
My code base also occasionally experiences the "Protocol error: Connection closed. Most likely the page has been closed." error message. The code uses a timeout of 10000 ms. Would it be advisable to update to a timeout of 30000 ms? Any other ideas?
Would it be advisable to update to a timeout of 30000 ms?
PR will be welcome.
I also experienced the same problem, which was fixed after adding heartbeat event listening after robot instantiation, as shown in the following code example:
const robot = new Wechaty()
......
.on('heartbeat', onHeartbeat)
.......
function onHeartbeat(str: any) {
console.log(`test heartbeat: ${str}`)
}
@frlute I have to say that, I believe whether you add a listener to the heartbeat
event or not, will absolutely have no effect to the Wechaty system.
0. Report Issue Guide
1. Expected behavior
Question: What behavior do you expect?
Answer: I want to keep the robot running
2. Actual behavior
Question: What actual behavior did you experience?
Answer: The robot has gone wrong for ten minutes.
3. Steps to reproduce your problem (and fixes, if any)
Start the robot, after the login is successful, the error occurs after running for ten minutes.
Question: What're the reproducible steps for us to see your problem?
Answer: gone wrong for ten minutes.
4. Full Output Logs
WARN PuppetPuppeteerBridge stop() page.close() exception: Error: Protocol error: Connection closed. Most likely the page has been closed. Connection closed4