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

Connection pool: put conn to idle queue if auth responded with unsuccessful code #336

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

TomCN0803
Copy link
Contributor

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

#334

Description:

As in connection_pool.go, ConnectionPool deactivates the current connection by putting it to idle queue if authentication failed (i.e. conn.authenticate returns an non-nil error). However, if authentication returns an nil error but with an unsuccessful ErrorCode, the connection won't be deactivated. Therefore, consecutive unsuccessful responses of authentication could eventually use up the connection pool, causing no new connections is able to be created.

How do you solve it?

I treat both authentication failure scenarios with the same handling, that the connection is put back to idle queue if failed.

Special notes for your reviewer, ex. impact of this fix, design document, etc:

return nil, err
}

// Check auth response
if resp.GetErrorCode() != nebula.ErrorCode_SUCCEEDED {
// if authentication responded with unsuccessful code, put connection back
pool.pushBack(conn)
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch!

@Nicole00 Nicole00 requested review from HarrisChu and Aiee April 8, 2024 09:51
@Nicole00 Nicole00 merged commit e7925a2 into vesoft-inc:master Apr 8, 2024
23 checks passed
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.

4 participants