apache / apache/pulsar-client-go
[BUG] When reconnecting to the server, the old connection is not closed
- Dominant language
- Go
- Stars
- 745
- Forks
- 389
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 3
Description
#### Expected behavior
When reconnecting to the server, the old connection should be closed.
#### Actual behavior
When reconnecting to the server, the old connection is not closed.
The following log progresses according to the timeline:
1. First, there is an active channel and producer that is writing data to the broker

2. In the case that the previous connection has not been disconnected, the client sends an add producer operation for the same producerName

3. This addition operation comes from the same ip of the client, a different port connection, and the producerName is equal to the previous one

4. Remove the producer in ServerCnx from the pulsar server, https://github.com/apache/pulsar/pull/11804, this PR modified the equals method of the Producer, resulting in the inability to remove the producer from the topic's prodcuers map.

5. Then the old connection starts to be disconnected, and the producer status of the server on the connection is cleared


6. The new channel connection keeps retrying addProducer, and the producer is added successfully after closing the old connection.
#### Steps to reproduce
#### System configuration
**Pulsar version**: x.y
pulsar-client-go: 0.7.0
pulsar broker: 2.8.1
Contributor guide
Research direction
Start at the client reconnect and addProducer entry points, then trace how the server's ServerCnx removes a Producer from the topic's producers map and review the linked PR's Producer equality change. Reproduce with pulsar-client-go 0.7.0 and Pulsar 2.8.1; done means the old connection closes and the new channel adds the producer without repeated retries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100