apache / apache/pulsar-client-go

[bug]: when client can't connect broker, run flush() raise panic

Open
#1,112 0 comments 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

async write message to broker with `sendAsync`, when client can't connect broker, run `producer.Flush()` raise panic.

#### Actual behavior

```c
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1004f487d]

goroutine 135 [running]:
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:63
github.com/apache/pulsar-client-go/pulsar.(*partitionProducer).failTimeoutMessages(0xc00018a6c0)
/Users/ruifengyun/go/pkg/mod/github.com/apache/pulsar-client-go@v0.11.0/pulsar/producer_partition.go:993 +0x6dd
created by github.com/apache/pulsar-client-go/pulsar.newPartitionProducer in goroutine 134
/Users/ruifengyun/go/pkg/mod/github.com/apache/pulsar-client-go@v0.11.0/pulsar/producer_partition.go:200 +0x97f
FAIL gitlab.planetmeican.com/titan/logclick-fluentbit/pkg/pulsar 195.365s
```

#### Steps to reproduce

First use write some data, and then kill pulsar. When producer.flush is called, this problem will occur.

I see you have solved the problem, please release a new version?

#### System configuration

pulsar-client-go: v0.11.0

Contributor guide

Open the contributing guide

Research direction

Start in pulsar/producer_partition.go at failTimeoutMessages, the stack-trace entry point, and inspect the producer.Flush path after sendAsync when the broker is killed. Reproduce with pulsar-client-go v0.11.0 and verify that flushing pending messages no longer causes a nil-pointer panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.