Skip to content
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

Flush on unbatched producer panics #897

Closed
flowchartsman opened this issue Dec 2, 2022 · 1 comment
Closed

Flush on unbatched producer panics #897

flowchartsman opened this issue Dec 2, 2022 · 1 comment

Comments

@flowchartsman
Copy link
Contributor

flowchartsman commented Dec 2, 2022

Had a call to producer.Flush() sitting around in some test code that I forgot to remove after disabling producer batching. After upgrading to head, the tests begin to panic.

producer, err := client.CreateProducer(ProducerOptions{
	Topic:           newTopicName(),
	DisableBatching: true,
})
ID, err := producer.Send(context.Background(), &ProducerMessage{
	Payload: []byte("hello"),
})
producer.Flush()
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x1005cf756]

goroutine 13 [running]:
github.com/apache/pulsar-client-go/pulsar.(*partitionProducer).internalFlushCurrentBatch(0xc0007bc240)
        /Users/me/go/pkg/mod/github.com/apache/pulsar-client-go@v0.9.1-0.20221129090243-884e13ecf0a1/pulsar/producer_partition.go:810 +0x36
github.com/apache/pulsar-client-go/pulsar.(*partitionProducer).internalFlush(0xc0007bc240, 0xc0006d6018)
        /Users/me/go/pkg/mod/github.com/apache/pulsar-client-go@v0.9.1-0.20221129090243-884e13ecf0a1/pulsar/producer_partition.go:992 +0x3e
github.com/apache/pulsar-client-go/pulsar.(*partitionProducer).runEventsLoop(0xc0007bc240)
        /Users/me/go/pkg/mod/github.com/apache/pulsar-client-go@v0.9.1-0.20221129090243-884e13ecf0a1/pulsar/producer_partition.go:452 +0x114
created by github.com/apache/pulsar-client-go/pulsar.newPartitionProducer
        /Users/me/go/pkg/mod/github.com/apache/pulsar-client-go@v0.9.1-0.20221129090243-884e13ecf0a1/pulsar/producer_partition.go:201 +0xaf6

This is because partitionProducer.internalFlushCurrentBatch() is called without checking to see if partitionProducer.batchBuilder is nil.

Expected behavior

NOP?

Actual behavior

Panic

flowchartsman added a commit to flowchartsman/pulsar-client-go that referenced this issue Dec 2, 2022
@flowchartsman
Copy link
Contributor Author

This issue was duplicated by #1064 and fixed by #1065. Closing this as superceded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant