wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
315 stars 65 forks source link

突发性出现【can not parse json data from grpc server.】然后心跳超时,接着【logout in wechaty】退出登录 #285

Open iguxiaobei opened 4 years ago

iguxiaobei commented 4 years ago

Important:Please file the issue follow the template, or we won't help you to solve the problem.

0. Report Issue Guide

  1. Please run the following command and check whether the problem has been fixed:
npm install wechaty-puppet-padlus@next
  1. Please search in the issue first, and make sure your problem had not been reported before

1. Versions

2. Describe the bug

突发性出现can not parse json data from grpc server.,最后,以【logout in wechaty】退出登录

3. To Reproduce

This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.

Steps to reproduce the behavior:

  1. run '...'
  2. ...
  3. ...

4. Expected behavior

没有异常或出现异常能自动重连来修复问题

5. Actual behavior

以【logout in wechaty】退出登录

6. Full Output Logs

08:57:23 ERR Config ###########################

08:57:23 ERR Config unhandledRejection: Error: can not parse json data from grpc server. [object Promise]

08:57:23 ERR Config ###########################

08:57:23 ERR Config process.on(unhandledRejection) promise.catch(can not parse json data from grpc server.) Config Error: can not parse json data from grpc server. at GrpcGateway. (/xiaoju-bot/node_modules/wechaty-puppet-padplus/dist/src/server-manager/grpc-gateway.js:478:35) at Generator.next () at /xiaoju-bot/node_modules/wechaty-puppet-padplus/dist/src/server-manager/grpc-gateway.js:8:71 at new Promise () at __awaiter (/xiaoju-bot/node_modules/wechaty-puppet-padplus/dist/src/server-manager/grpc-gateway.js:4:12) at ClientReadableStream.stream.on (/xiaoju-bot/node_modules/wechaty-puppet-padplus/dist/src/server-manager/grpc-gateway.js:391:41) at ClientReadableStream.emit (events.js:182:13) at ClientReadableStream.EventEmitter.emit (domain.js:441:20) at addChunk (_stream_readable.js:283:12) at readableAddChunk (_stream_readable.js:264:11) at ClientReadableStream.Readable.push (_stream_readable.js:219:10) at Object.onReceiveMessage (/xiaoju-bot/node_modules/grpc/src/client_interceptors.js:1263:19) at InterceptingListener.recvMessageWithContext (/xiaoju-bot/node_modules/grpc/src/client_interceptors.js:607:19) at /xiaoju-bot/node_modules/grpc/src/client_interceptors.js:707:14 (node:10) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 20)

08:57:53 ERR GRPC_GATEWAY ApiType: HEARTBEAT request timeout, traceId: 7e1785a1-e768-41ba-aa8e-f6ae5f5d54df

08:57:53 ERR GRPC_GATEWAY can not get heartbeat from grpc server

08:57:53 INFO PadplusManager ready to restart due to receive event: reconnect

08:58:23 ERR GRPC_GATEWAY ApiType: HEARTBEAT request timeout, traceId: 68ad1b93-4bcf-4477-9eae-c3d6003f93b5

08:58:23 ERR GRPC_GATEWAY can not get heartbeat from grpc server

08:58:23 INFO PadplusManager ready to restart due to receive event: reconnect

08:58:24 ERR GRPC_GATEWAY ApiType: INIT request timeout, traceId: fd9c4602-3ac5-4160-9a60-e83324b07371

08:58:24 ERR PadplusUser can not get callback result of INIT

08:58:54 ERR GRPC_GATEWAY ApiType: INIT request timeout, traceId: b9c31e2f-5450-4bca-abdb-f0b00992a3c7

08:58:54 ERR PadplusUser can not get callback result of INIT

09:01:23 WARN Puppet constructor() watchdog.on(reset) reason: {"data":"","timeout":240000}

09:01:23 INFO PuppetPadplus stop()

09:01:23 INFO PuppetPadplus logout(true, logout in wechaty)

09:01:23 INFO logoutListener BOT LOGOUT: 蓝秘书 logout

$ WECHATY_LOG=silly node yourbot.js

Question: Paste your FULL(DO NOT ONLY PROVIDE FRAGMENTS) log messages
Answer:

7. Additional context

Add any other context about the problem here.

[bug]

su-chang commented 4 years ago

Analyze the Log It seems grpc listen on some bad JSON data from padplus-server, and can not parse this data successfully.

When the bot miss padplus-server heartbeat, it will try to reconnect by padplus, but it seems that the bot lost connect with padplus-server.

In the end, wechaty watch dog timeout, and reset itself, so we could listen on logout event in wechaty.

Conclusion We have to keep watching on this issue, if we can not reproduce it.