Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second call of addConnection when retrying connection doesn't update connectionPromise #177

Open
drunkhacker opened this issue Oct 19, 2018 · 1 comment

Comments

@drunkhacker
Copy link

drunkhacker commented Oct 19, 2018

Version: 2.1.0 release.
Symptom: Even after I saw the rabbot made a connection after the first failure, publish or request is always rejected with error of 'no endpoint could not be reached'.

Details:

I sometimes get the first ETIMEDOUT error when call addConnection, but rabbot reconnects and gets the connection successfully. I can check the established connection by setup the event handler on 'connected' event.

But when I try to send any request to an exchange, I get 'No endpoint could not be reached' error, and rabbot.request or rabbot.publish is rejected immediately. After I digging into code little bit, I found that it is because connectionPromise is not be replaced (or resolved) after the second connection trial succeeded. connectionPromise is set as rejected because the first connection trial ends with error, and publish or request operation on rabbot always refer first connectionPromise. (see onExchange function of src/index.js)

Relevant code position is, src/index.js's 129th line. Inside the second call of addConnection, connectionPromise is newly created, but if (!this.connections[ name ].promise) { this line doesn't allow connection promise being updated.

FYI: that line is introduced in 4bfd352

@antmarot
Copy link

antmarot commented Dec 4, 2018

Good job finding the line!

Related issue is discussed here #108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants