xiannvyou opened a new issue, #21594:
URL: https://github.com/apache/pulsar/issues/21594

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   broker version:2.7.4
   client version : github.com/apache/[email protected] 
   
   ### Minimal reproduce step
   
   Go code
   
   > When the message backlog exceeds 3000 after the initial subscription, 
attempting to re-subscribe will result in a failure. The consumer group still 
retains the previous consumers.
   
   ```go
   package main
   
   import (
        "context"
        "fmt"
        "os"
        "os/signal"
        "syscall"
        "time"
   
        "github.com/apache/pulsar-client-go/pulsar"
   )
   
   func main() {
        client, err := pulsar.NewClient(pulsar.ClientOptions{URL: ""})
        if err != nil {
                panic(err)
        }
        subscribe, err := client.Subscribe(pulsar.ConsumerOptions{
                Topic:            "persistent://~/~/~",
                SubscriptionName: "go-test",
                Type:             pulsar.Shared,
                SubscriptionMode: pulsar.NonDurable,
                KeySharedPolicy:  nil,
        })
        if err != nil {
                // panic: server error: PersistenceError: 
java.util.concurrent.CompletionException: java.lang.NullPointerException
                panic(err)
        }
        go func() {
   
                for {
                        msg, err := subscribe.Receive(context.Background())
                        if err != nil {
                                fmt.Printf("%v/n", err)
                        }
                        // simulated consumption power
                        time.Sleep(5 * time.Second)
                        _ = subscribe.Ack(msg)
                }
        }()
        signals := make(chan os.Signal, 1)
        signal.Notify(make(chan os.Signal, 1), syscall.SIGHUP, syscall.SIGINT, 
syscall.SIGTERM, syscall.SIGQUIT)
        <-signals
        subscribe.Close()
   }
   ``` 
   
   ### What did you expect to see?
   
   After the code execution is terminated, the subscription group should 
disappear. Upon re-subscription, only the new consumers will be present in the 
subscription group.
   
   ### What did you see instead?
   
   The subscription group does not disappear after closing the code. Upon 
re-subscription, it fails to subscribe successfully. The consumer information 
can still be seen in the subscription group, but it is unable to consume 
messages and remains permanently displayed in the subscription information.
   
![image](https://github.com/apache/pulsar/assets/95083676/312e3514-6ae4-4dd1-8eb6-375a4a341379)
   The mentioned IP addresses refer to the consumers that have already been 
destroyed due to code termination, but still exist in the subscription group.
   
   
   
   
   
   
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to