apache / apache/pulsar-client-go

Producer can not reconnect to broker after server restart

Open
#733 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
745
Forks
389
Avg merge
3d 20h
Merged PRs (30d)
3

Description

#### Expected behavior

Producer reconnect to broker after server restart.

#### Actual behavior

In the current code, I find that if a connection is closed, it will try to stop all producer listeners and consumer handlers registered on it. But if the producer has set the connection to `conn` and does not register the listener to this connection in https://github.com/apache/pulsar-client-go/blob/1df5596aa7a351c6f43edb53f54b2a14b83b0073/pulsar/producer_partition.go#L264-L265. And the connection is closed by another goroutine because of `connection.handleSendError` https://github.com/apache/pulsar-client-go/blob/1df5596aa7a351c6f43edb53f54b2a14b83b0073/pulsar/internal/connection.go#L793. The producer can not do `reconnectToBroker` because no signal will sent to `connectClosedCh`.

Maybe we should check the result of `RegisterListener` and call `ConnectionClosed` by manually?
#### Steps to reproduce

It's not stable to reproduce

#### System configuration
**Pulsar version**: 0.7.0

Contributor guide

Open the contributing guide

Research direction

Start in pulsar/producer_partition.go around the RegisterListener call and compare it with connection.handleSendError in pulsar/internal/connection.go. Reproduce a broker restart if possible and trace the connection-closed signal; done means a producer reconnects after the connection is closed without losing its recovery path.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.