nats.js: Error when reconnecting to server & Attempting to send messages

We’ve encountered a conditional bug where the NATS client will attempt to send messages, despite no longer being connected to the server. In the code it’s not checking to see if the socket is still attached or not and casuses an error. The side affect appears to prevent the application from completing a reconnect as well. Once completely restarted it can once again reconnect to the server.

You can see our code usage here: https://github.com/nodecraft/appframe-nats.js

[14:34:40] [LOG]: [NATS] Lost connection from server. Reconnecting... at appframe._log (~/node_modules/appframe/appframe.js:882:15)
[14:34:40] [ERROR]: Cannot read property 'resume' of null
TypeError: Cannot read property 'resume' of null
    at Client.processInbound (~/node_modules/nats/lib/nats.js:761:16)
    at Socket.<anonymous> (~/node_modules/nats/lib/nats.js:468:12)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:547:20) at appframe.debug (~/node_modules/appframe/appframe.js:864:15)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 29 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I don’t want minecraft severs to fail. 😃