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

[BUG] pulsar.(*producer).Send() panic when topic is deleted #1129

Open
Violet-eve-garden opened this issue Nov 14, 2023 · 2 comments
Open

[BUG] pulsar.(*producer).Send() panic when topic is deleted #1129

Violet-eve-garden opened this issue Nov 14, 2023 · 2 comments

Comments

@Violet-eve-garden
Copy link

Violet-eve-garden commented Nov 14, 2023

Expected behavior

When topic is deleted, should return Topic Not Found error instead of panic.

Actual behavior

image

Steps to reproduce

  1. create topic;
  2. create producer and send messages in loop;
  3. force delete topic while producer is connected;
  4. wait for a period of time, you can see the panic;

System configuration

Pulsar version: 0.11.1

@Violet-eve-garden Violet-eve-garden changed the title pulsar.(*producer).Send() panic when topic is deleted [bug ]pulsar.(*producer).Send() panic when topic is deleted Nov 14, 2023
@Violet-eve-garden Violet-eve-garden changed the title [bug ]pulsar.(*producer).Send() panic when topic is deleted [BUG] pulsar.(*producer).Send() panic when topic is deleted Nov 14, 2023
@Violet-eve-garden
Copy link
Author

Violet-eve-garden commented Nov 14, 2023

if oldProducers != nil {
if oldNumPartitions == newNumPartitions {
p.log.Debug("Number of partitions in topic has not changed")
return nil
}
p.log.WithField("old_partitions", oldNumPartitions).
WithField("new_partitions", newNumPartitions).
Info("Changed number of partitions in topic")
}
p.producers = make([]Producer, newNumPartitions)

  • The bug may be caused by the runBackgroundPartitionDiscovery behavior.
  • When topic is deleted or the number of partitions is changed, it unsafely change p.producers which is the member of struct producer.

@gunli
Copy link
Contributor

gunli commented Dec 13, 2023

Hi @Violet-eve-garden TopicIsNotFound is handled in the latest master branch, would you please try with the latest code?

You can update it by:
go get -u github.com/apache/pulsar-client-go@bd11581867c88f93e4b6f247d82914f9eb4ee476

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

No branches or pull requests

2 participants