BJTiso opened a new issue #4361: Go client: multi-topic unsubscribe hangs when 
regex does not match any topics
URL: https://github.com/apache/pulsar/issues/4361
 
 
   **Describe the bug**
   When performing multi-topic unsubscribe on a topic regex that does not not 
match any topics, then Unsubscribe call will block indefinitely.
   
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. launch container ```apachepulsar/pulsar``` and listen on port 6650 on host
   
   2. use ```github.com/apache/pulsar/pulsar-client-go 
v0.0.0-20190517092409-1f4a836a46483db408e0bf39903215974262d946``` in go.mod 
which pulls 2.3.1 + build fix from #4212 for example:
   
   ```
   module pulsartest
   
   require github.com/apache/pulsar/pulsar-client-go 
v0.0.0-20190517092409-1f4a836a46483db408e0bf39903215974262d946
   ```
   
   3.  create test code to subscribe to erroneous multi-topic pattern 
   ```go
   package main
   
   import (
        "github.com/apache/pulsar/pulsar-client-go/pulsar"
        "log"
        "runtime"
   )
   
   func main() {
        client, err := pulsar.NewClient(pulsar.ClientOptions{
                URL: "pulsar://localhost:6650",
                OperationTimeoutSeconds: 5,
                MessageListenerThreads: runtime.NumCPU(),
        })
        if err != nil {
                log.Fatalf("Could not instantiate Pulsar client: %v", err)
        }
        msgChannel := make(chan pulsar.ConsumerMessage)
        consumerOpts := pulsar.ConsumerOptions{
                TopicsPattern:            
"persistent://public/default/1-.*-fakefakefake",
                SubscriptionName: "my-subscription-1",
                Type:             pulsar.Exclusive,
                MessageChannel:   msgChannel,
        }
        consumer, err := client.Subscribe(consumerOpts)
        if err != nil {
                log.Fatalf("Could not establish subscription: %v", err)
        }
        err = consumer.Unsubscribe()
        if err != nil {
                log.Fatalf("Could not establish subscription: %v", err)
        }
   }
   ```
   3. ```go build && ./pulsartest``` to reproduce
   
   **Expected behavior**
   pulsartest will return
   
   **Actual behavior**
   pulsartest hangs indefinitely 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to