fix(java-client): fix Negotiation failed
after a session with authentication enabled is closed
#2132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolve #2133.
After the session with authentication enabled to remote server is closed(e.g.
the server is killed), the flag(i.e.
authSucceed
) marking whether the sessionhas been authenticated is still kept
true
. Afterwards, while trying to creatinganother new connection to the same remote server for this session, some requests
would be pending before it is connected successfully. Once the session is connected,
the pending requests would be sent to the remote server. Typically, the first element
of the pending queue would be a non-negotiation request(
query_cfg_request
tothe meta server for example), and the second one would be a negotiation request.
Normally, the non-negotiation request would be moved to another pending queue
for authentication; however, since the flag still marks that the session has been
authenticated successfully, the non-negotiation request would be directed to the
remote server which would never reply to the client since the server think that the
negotiation has not been launched. However, since the client has actually launched
the negotiation, it would close the session due to timeout or having not receiving
response from the server for long time. Therefore, the above process would repeat
again.
To fix this problem, the flag should be reset after the session is closed. Then, the
client would never send non-negotiation requests before the negotiation with the
server becomes successful.