wechaty / puppet-service

Wechaty Puppet Provider for providing/consuming the Wechaty Puppet Service
https://paka.dev/npm/wechaty-puppet-service
Apache License 2.0
75 stars 18 forks source link

Memory leak: PuppetServer #22

Open huan opened 4 years ago

huan commented 4 years ago
00:52:30 VERB PuppetServiceImpl contactPayload()
00:52:30 VERB PuppetServiceImpl contactPayload()
00:52:30 VERB PuppetServiceImpl contactPayload()
00:52:30 VERB PuppetServiceImpl contactPayload()
00:52:30 VERB PuppetServiceImpl contactPayload()
00:52:30 VERB PuppetServiceImpl contactPayload()
00:52:44 VERB PuppetServiceImpl ding()
00:52:44 VERB EventStreamManager grpcEmit(EVENT_TYPE_DONG[3], {"data":"no heartbeat for 15 seconds?"})
00:52:59 VERB PuppetServiceImpl ding()
00:52:59 VERB EventStreamManager grpcEmit(EVENT_TYPE_DONG[3], {"data":"no heartbeat for 15 seconds?"})
00:53:14 VERB PuppetServiceImpl ding()
00:53:14 VERB EventStreamManager grpcEmit(EVENT_TYPE_DONG[3], {"data":"no heartbeat for 15 seconds?"})
00:53:29 VERB PuppetServiceImpl ding()
00:53:29 VERB EventStreamManager grpcEmit(EVENT_TYPE_DONG[3], {"data":"no heartbeat for 15 seconds?"})
00:53:34 VERB Bridge processEvent(RECV_PICTURE_MSG)
00:53:34 VERB Donut(ffi-adapter) SendWeChatData(1,{"data":{"dest_file":"C:\\Users\\huan\\Documents\\WeChat Files\\zixia008\\FileStorage\\Image\\2020-03\\97b142ed351e85bba1e58a6918c335e3.jpg","src_file":"C:\\Users\\huan\\Documents\\WeChat Files\\zixia008\\FileStorage\\Image\\2020-03\\97b142ed351e85bba1e58a6918c335e3.dat"},"type":11085})
00:53:34 VERB Bridge processEvent(RECV_TEXT_MSG)
00:53:34 VERB PuppetWindows onMessage({"at_user_list":[],"from_wxid":"chenjunen","is_pc":0,"msg":"https://sourceforge.net/projects/god-of-thunder-1994-dos-game/","msgid":"6676259669689584473","room_wxid":"4896535038@chatroom","timestamp":1585328012,"to_wxid":"4896535038@chatroom","wx_type":1})
00:53:34 VERB PuppetWindows contactRawPayload(chenjunen)
00:53:34 VERB Bridge contactRawPayload(chenjunen)
00:53:34 VERB Message static load(6676259669689584473)
00:53:34 VERB Message constructor(6676259669689584473) for class Message
00:53:34 VERB Message ready()
00:53:34 VERB Puppet messagePayload(6676259669689584473)
00:53:34 VERB PuppetWindows messageRawPayload(6676259669689584473)
00:53:34 VERB Bridge messageRawPayload(6676259669689584473)
00:53:34 VERB EventStreamManager grpcEmit(EVENT_TYPE_MESSAGE[2], {"messageId":"6676259669689584473"})
00:53:34 VERB PuppetWindows messageRawPayloadParser({"at_user_list":[],"from_wxid":"chenjunen","is_pc":0,"msg":"https://sourceforge.net/projects/god-of-thunder-1994-dos-game/","msgid":"6676259669689584473","room_wxid":"4896535038@chatroom","timestamp":1585328012,"to_wxid":"4896535038@chatroom","wx_type":1})
00:53:34 VERB Room ready()
00:53:34 VERB IoClient onMessage(Message#Text[🗣Contact<陈军恩>@👥Room<中国.NET-大道消息>]     https://sourceforge.net/projects/god-of-thunder-1994-dos-game/)
00:53:34 VERB Bridge processEvent(DECRYPT_IMG_MSG)
00:53:34 VERB Donut(ffi-adapter) SendWeChatData(1,{"data":{"dest_file":"C:\\Users\\huan\\Documents\\WeChat Files\\zixia008\\FileStorage\\Image\\Thumb\\2020-03\\74669fac3cd88158cf65cfb76687a089_t.jpg","src_file":"C:\\Users\\huan\\Documents\\WeChat Files\\zixia008\\FileStorage\\Image\\Thumb\\2020-03\\74669fac3cd88158cf65cfb76687a089_t.dat"},"type":11085})
00:53:34 VERB PuppetServiceImpl messagePayload()
00:53:34 VERB Puppet messagePayload(6676259669689584473)
00:53:34 VERB Bridge processEvent(DECRYPT_IMG_MSG)

<--- Last few GCs --->

[11664:01F84628] 94290414 ms: Mark-sweep 659.0 (730.6) -> 659.0 (730.6) MB, 2677.5 / 0.0 ms  (average mu = 0.109, current mu = 0.000) last resort GC in old space requested
[11664:01F84628] 94292988 ms: Mark-sweep 659.0 (730.6) -> 658.9 (739.1) MB, 2552.8 / 0.0 ms  (average mu = 0.062, current mu = 0.008) allocation failure GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 2DAC993E]
Security context: 0x10192079 <JSObject>
    1: resolve [1990560D] [path.js:~127] [pc=367F95F4](this=0x19905629 <Object map = 0461E849>)
    2: arguments adaptor frame: 1->0
    3: toNamespacedPath [19905671] [path.js:~546] [pc=0823CE91](this=0x19905629 <Object map = 0461E849>,0x1ced3481 <String[96]\: C:\\Users\\huan\\Documents\\WeChat Files\\zixia008\\FileStorage\\File\\2020-03\\3-\x5982\x4f55\x751f\x6210\x...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 007A025E v8::internal::OptimizedCompilationInfo::bailout_reason+68190
 2: 00B0745E v8::internal::FatalProcessOutOfMemory+830
 3: 00B8ECF2 v8::internal::Heap::RootIsImmortalImmovable+11490
 4: 00B858BA v8::internal::Heap::CollectGarbage+938
 5: 00B8D1EE v8::internal::Heap::RootIsImmortalImmovable+4574
huan commented 4 years ago
17:21:04 VERB PuppetWindows contactRawPayloadParser({"account":"","avatar":"http://wx.qlogo.cn/mmhead/ver_1/hmaLz64dqfA7HNnARQUYmicOX3KdicNY0saU57mql6w8XDH2jPm4TqXphsmAKeOUvMCyEkvxkzqI8PGXeL5YG5TzmG7CiaLt9OeABMFneMib9dI/132","city":"","country":"","nickname":"钱雯","province":"","remark":"","sex":0,"wxid":"wxid_rc3k1edpk1qm21"})
17:21:04 VERB PuppetWindows contactRawPayloadParser({"account":"","avatar":"http://wx.qlogo.cn/mmhead/ver_1/H6blcGtSktcWiamXtHMpH9UibXETPFkibT75kibS5anFX2BaauD2UBYECwFiagO1unNZ9vNNNibKnREic1vDRXCpfcNbxicVv03L5CA1Lic07vNEEl4Q/132","city":"","country":"","nickname":"007","province":"","remark":"","sex":0,"wxid":"wxid_mdeccf7xg6zq22"})
17:21:04 VERB PuppetWindows contactRawPayloadParser({"account":"","avatar":"http://wx.qlogo.cn/mmhead/ver_1/Kp16taHgEh3uMaLDyOd3k1sWZAMAjOHtpF5uic3Eortu7P4UxMZSvfKVgAxDib9mBym5HMR6aUaNIIY6pKZibfQB5SHpYYtQ7IEkd0ibibQhdXuM/132","city":"","country":"","nickname":"山谷","province":"","remark":"","sex":0,"wxid":"wxid_brlr36pzo90a12"})
17:21:04 VERB PuppetWindows contactRawPayloadParser({"account":"","avatar":"http://wx.qlogo.cn/mmhead/ver_1/ptY0HCCedznLUCPtXJGULKJJoOJs1A3oUvR3L3GDVliaE0TIficguXXTR3Q3NEfw96KBKibviaPdOTDia82aw2vVwmQ/132","city":"","country":"","nickname":"__微笑、","province":"","remark":"","sex":0,"wxid":"F13686335877"})

<--- Last few GCs --->

[19332:02047F00]  8842868 ms: Mark-sweep 675.8 (736.4) -> 675.4 (736.4) MB, 2120.4 / 0.0 ms  (average mu = 0.155, current mu = 0.027) allocation failure scavenge might not succeed
[19332:02047F00]  8844834 ms: Mark-sweep 676.2 (736.4) -> 675.7 (737.9) MB, 1915.1 / 0.0 ms  (average mu = 0.100, current mu = 0.026) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x20492079 <JSObject>
    0: builtin exit frame: decode(aka parse)(this=0x07a4adb1 <Object map = 0C5B4531>,0x267af3bd <String[313]\: "{\\"account\\":\\"\\",\\"avatar\\":\\"http://wx.qlogo.cn/mmhead/ver_1/b4MrV9bL1xkw40KxSTOL6bSiaHVh4vwZ0yqCiaLibM92bFl29hzAAVfLoXmPejgXQsIicVyQ1Ru5hKuJFj968OFia11oG0cXTvBbk1ABtkXZRYl0/132\\",\\"city\\":\\"\\",\\"country\\":\\"\\",\\"nickname\\":\\"\x5218\x5c0f\x80d6\\",\\"province\\":\\"\\"...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 007A025E v8::internal::OptimizedCompilationInfo::bailout_reason+68190
 2: 00B0745E v8::internal::FatalProcessOutOfMemory+830
 3: 00B8ECF2 v8::internal::Heap::RootIsImmortalImmovable+11490
 4: 00B858BA v8::internal::Heap::CollectGarbage+938
 5: 00B8D1EE v8::internal::Heap::RootIsImmortalImmovable+4574
huan commented 4 years ago

Solution

Start Node.js with --max-old-space-size=3049:

node --max-old-space-size=3049 -r ts-node/register bin/io-client

See: https://github.com/TypeStrong/ts-node/issues/261#issuecomment-402093879