puppet-service icon indicating copy to clipboard operation
puppet-service copied to clipboard

Weird grpc error: address already in use

Open windmemory opened this issue 4 years ago • 1 comments

I've observed this weird log today, the grpc server failed to start itself since the address has been bind. Let's keep an eye on this problem.

13:12:20 VERB Wechaty wechatifyUserModules(Puppet#0<PuppetWork>(puppet_wxwork_17aa17442cfb0dea))
13:12:20 VERB PuppetWork start()
13:12:20 VERB StateSwitch <PuppetWork> on(pending) <- (false)
13:12:20 VERB PuppetWork startManager()
13:12:20 VERB Bridge start()
13:12:20 VERB Bridge start() websocket not initialized, initializing...
13:12:20 VERB Bridge getConnectCallback()
13:12:20 VERB Bridge getCloseCallback()
13:12:20 VERB Bridge getEventCallback()
13:12:31 VERB Manager initQueue()
13:12:31 INFO Manager start() started
13:12:31 VERB StateSwitch <PuppetWork> on(true) <- (pending)
13:12:31 VERB PuppetWork start() started
13:12:31 VERB Wechaty on(heartbeat, listener) registering... listenerCount: 1
13:12:31 VERB StateSwitch <Wechaty> on(true) <- (pending)
13:12:31 VERB IoClient startHostie()
13:12:31 VERB PuppetServer constructor({endpoint: "0.0.0.0:14132", puppet: "Puppet#0<PuppetWork>(puppet_wxwork_17aa17442cfb0dea)", token: "puppet_wxwork_17aa17442cfb0dea"})
13:12:31 VERB PuppetServer start()
13:12:31 VERB EventStreamManager constructor(Puppet#0<PuppetWork>(puppet_wxwork_17aa17442cfb0dea))
E0921 06:12:31.596000000   500 server_chttp2.cc:40] {"created":"@1600665151.596000000","description":"No address added out of total 1 resolved","file":"d:\a\grpc-node\grpc-node\packages\grpc-native-core\deps\grpc\src\core\ext\transport\chttp2\server\chttp2_server.cc","file_line":394,"referenced_errors":[{"created":"@1600665151.596000000","description":"Failed to add port to server","file":"d:\a\grpc-node\grpc-node\packages\grpc-native-core\deps\grpc\src\core\lib\iomgr\tcp_server_custom.cc","file_line":404,"referenced_errors":[{"created":"@1600665151.596000000","description":"Failed to listen to port","file":"d:\a\grpc-node\grpc-node\packages\grpc-native-core\deps\grpc\src\core\lib\iomgr\tcp_uv.cc","file_line":72,"grpc_status":14,"os_error":"address already in use"}]}]}
13:12:31 ERR IoClient start() exception: grpc server bind fail!
13:12:31 VERB StateSwitch <IoClient> off(true) <- (false)
13:12:31 ERR Client start() fail: Error: grpc server bind fail!
13:12:31 VERB IoClient quit()
13:12:31 VERB StateSwitch <IoClient> off(pending) <- (true)
13:12:31 VERB Wechaty <@juzibot/wechaty-puppet-wxwork> stop() v0.48.3 is stopping ...
13:12:31 VERB StateSwitch <WechatyReady> off(true) <- (true)
13:12:31 VERB StateSwitch <Wechaty> off(pending) <- (false)
13:12:31 VERB PuppetWork stop()
13:12:31 VERB StateSwitch <PuppetWork> off(pending) <- (false)
13:12:31 VERB PuppetWork stopManager()
13:12:31 VERB Manager stop()
13:12:31 VERB Bridge stop()

windmemory avatar Sep 21 '20 19:09 windmemory

This is caused by multiple io-client process running at the same time. And seems like when the puppet is crashed or stopped, the io-client process is not stopped for some reason.

Still need more investigation on this issue.

windmemory avatar Oct 27 '20 08:10 windmemory