Skip to content

Revert "Fix stuck when reconnect broker (#703)" - #767

Merged
wolfstudy merged 1 commit into
apache:masterfrom
lhotari:lh-revert-connection-marked-closed
May 23, 2022
Merged

wolfstudy merged 1 commit into
apache:masterfrom
lhotari:lh-revert-connection-marked-closed

Conversation

@lhotari

@lhotari lhotari commented Apr 26, 2022

Copy link
Copy Markdown
Member

Fixes #766

Motivation

The change made in #703 is invalid. See #766 .

One of the motivation of #703 was to implement similar behavior as there is in Java SDK. The change didn't do that.
In the Java SDK, the concepts (classes) are fairly misleading, and something that might seem to be a connection close isn't one. The ClientHandler is really a reference to a connection in the Java SDK. The ClientCnx (which holds the TCP/IP connection) isn't closed in the Java SDK in ClientHandler.connectionClosed:
https://github.com/apache/pulsar/blob/04aa9e8e51869d1621a7e25402a656084eebfc09/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java#L122-L141

Modifications

This reverts #703 / commit 1a8432c.

@lhotari
lhotari requested review from merlimat, wolfstudy and zymap April 26, 2022 11:07
@lhotari lhotari self-assigned this Apr 26, 2022
@wolfstudy

Copy link
Copy Markdown
Member

Hello @lhotari

The processing of #703 is indeed a bit rough. For scenarios where multiple topics reuse the same connection, frequent reconnection does have a big impact.

The #703 originally wanted to solve the problem that the #693 could not reconnect during the reconnection process. In the Go SDK, there is currently a no good way to release the reference of the current connection object like the Java SDK, and then return the real TCP connection to the connection pool. Therefore, the method of closing the connection is temporarily used in the repair of #703.

If there is a more elegant way to handle this, please feel free to communicate.

@wolfstudy

Copy link
Copy Markdown
Member

The #703 fix does fix the #693 's problem, but it's probably not an elegant way to do it.

@wolfstudy

Copy link
Copy Markdown
Member

Closing the TCP connection here is indeed an inelegant operation, I merge the change first, and then use state management to fix the problem

@wolfstudy
wolfstudy merged commit 67e2075 into apache:master May 23, 2022
jayxhj pushed a commit to billowqiu/pulsar-client-go that referenced this pull request Jun 6, 2022
jiaqingchen pushed a commit to billowqiu/pulsar-client-go that referenced this pull request Jul 18, 2022
zwb1234567 pushed a commit to billowqiu/pulsar-client-go that referenced this pull request Jul 19, 2022
jiaqingchen added a commit to billowqiu/pulsar-client-go that referenced this pull request Jul 19, 2022
Revert "Revert "Fix stuck when reconnect broker (apache#703)" (apache#767)"
@lhotari

lhotari commented Dec 22, 2022

Copy link
Copy Markdown
Member Author

@billowqiu @zwb1234567 @jiaqingchen Would you mind explaining why you reverted this change in your fork with billowqiu#15 ? It would be useful if you'd share the details so that we could improve the official Apache Pulsar Go client.
/cc @wolfstudy @zzzming @pgier

@billowqiu

Copy link
Copy Markdown
Contributor

@billowqiu @zwb1234567 @jiaqingchen Would you mind explaining why you reverted this change in your fork with billowqiu#15 ? It would be useful if you'd share the details so that we could improve the official Apache Pulsar Go client. /cc @wolfstudy @zzzming @pgier

In some cases, not closing the connection causes the producer to enter an abnormal state in which all send requests are fail with "request timed out"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pulsar-client-go marks the connection closed when a "producer close" or "consumer close" message is received.

5 participants