Skip to content

Fix pending requests failed with ResultConnectError when disconnecting #322

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

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

BewareMyPower
Copy link
Contributor

@BewareMyPower BewareMyPower commented Sep 28, 2023

Motivation

When there are multiple pending requests in the same ClientConnection, if one request failed with a retryable error, e.g. the ServiceUnitNotReady error when finding the owner broker of a topic, the socket will be closed in checkServerError and close() will be called subsequently in handleRead (err is eof or operation_failed). However, the default value of 1st parameter is ResultConnectError for close, which is not retryable.

Modifications

If the connection is disconnected by the client, pass ResultDisconnected to close and treat it as retryable.

closeSocket is replaced with close(ResultDisconnected) to avoid the connection being the status that socket is closed but TLS stream is not closed.

@BewareMyPower BewareMyPower added the bug Something isn't working label Sep 28, 2023
@BewareMyPower BewareMyPower added this to the 3.4.0 milestone Sep 28, 2023
@BewareMyPower BewareMyPower self-assigned this Sep 28, 2023
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-close-error branch 2 times, most recently from 559fce9 to 74bb9a0 Compare October 4, 2023 11:28
### Motivation

When there are multiple pending requests in the same `ClientConnection`,
if one request failed with a retryable error, e.g. the
`ServiceUnitNotReady` error when finding the owner broker of a topic,
the socket will be closed in `checkServerError` and `close()` will be
called subsequently in `handleRead` (`err` is `eof` or
`operation_failed`). However, the default value of 1st parameter is
`ResultConnectError` for `close`, which is not retryable.

### Modifications

If the connection is disconnected by the client, pass
`ResultDisconnected` to `close` and treat it as retryable.

closeSocket is replaced with close(ResultDisconnected) to avoid the connection being the status that socket is closed but TLS stream is not closed.
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-close-error branch from 74bb9a0 to 8c99505 Compare October 5, 2023 10:45
BewareMyPower added a commit to streamnative/pulsar-client-cpp that referenced this pull request Oct 5, 2023
apache#322)

### Motivation

When there are multiple pending requests in the same `ClientConnection`,
if one request failed with a retryable error, e.g. the
`ServiceUnitNotReady` error when finding the owner broker of a topic,
the socket will be closed in `checkServerError` and `close()` will be
called subsequently in `handleRead` (`err` is `eof` or
`operation_failed`). However, the default value of 1st parameter is
`ResultConnectError` for `close`, which is not retryable.

### Modifications

If the connection is disconnected by the client, pass
`ResultDisconnected` to `close` and treat it as retryable.

closeSocket is replaced with close(ResultDisconnected) to avoid the
connection being the status that socket is closed but TLS stream is not
closed.
@merlimat merlimat merged commit f2c580b into apache:main Oct 6, 2023
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-close-error branch October 7, 2023 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants