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

fix reconnect issue for nodejs #2407

Merged
merged 4 commits into from
Oct 25, 2022

Conversation

wujjpp
Copy link
Contributor

@wujjpp wujjpp commented Jun 11, 2021

CHANGES:

  1. remove /lib/nodejs/lib/thrift/connection.js#L233-L236, it cause thrift cannot do reconnect
  2. add forceClose variable for indicating close action caseued by manual, and give up reconnecting

@Jens-G
Copy link
Member

Jens-G commented Jun 23, 2021

Anybody who could doublecheck this patch?

@wujjpp
Copy link
Contributor Author

wujjpp commented Sep 6, 2021

Anybody who could doublecheck this patch?

We have used this patch in production

Copy link
Member

@emmenlau emmenlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, but I'm no expert in this. Also, the same change may be needed in other Javascript-implementations?

@@ -198,6 +200,16 @@ Connection.prototype.connection_gone = function () {
var self = this;
this.connected = false;

// If closed by manual, emit close event and cancel reconnect process
if(this.forceClose) {
self.emit("close");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be overly pedantic, but would it be better to first clear the timer and then emit close? In other words, move the line self.emit("close"); down below the if (this.retry_timer) { block?

Copy link
Contributor Author

@wujjpp wujjpp Dec 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, close event handler maybe cause panic.
I have updated this change

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 16, 2022
@emmenlau
Copy link
Member

Generally looks good to me. Could you kindly rebase on latest master and push again?

@stale
Copy link

stale bot commented Apr 16, 2022

This issue is no longer stale. Thank you for your contributions.

@stale stale bot removed the wontfix label Apr 16, 2022
@wujjpp
Copy link
Contributor Author

wujjpp commented May 25, 2022

@emmenlau rebased on latest master and pushed

@Jens-G Jens-G merged commit 22aa3e5 into apache:master Oct 25, 2022
@wujjpp wujjpp deleted the thrift-nodejs-reconnect-issue branch October 26, 2022 04:11
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

Successfully merging this pull request may close these issues.

3 participants