[Bug] When using a NonDurable subscription in Pulsar, subscription failure occurs in the presence of message backlog accumulation.
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### 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/pulsar-client-go@v0.11.0
### 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.

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?
- [ ] I'm willing to submit a PR!
Contributor guide
Assessment
This issue has not been assessed yet.