YanshuoH opened a new issue, #1026:
URL: https://github.com/apache/pulsar-client-go/issues/1026
#### Expected behavior
Multiple calls to `client.Close` should not cause panic.
#### Actual behavior
Multiple calls to `client.Close` cause panic
#### Steps to reproduce
Create a client and close twice will reproduce the bug.
eg.
```
func TestPanic(t *testing.T) {
srv := test.GetServerInfo()
client, err := pulsar.NewClient(pulsar.ClientOptions{
URL: fmt.Sprintf("pulsar://%s:%s",
srv.PulsarTestServerHost, srv.PulsarTestServerTCPPort),
})
if err != nil {
t.Fatal(err)
}
client.Close()
client.Close()
}
```
Output:
```
=== RUN TestPanic
--- FAIL: TestPanic (0.00s)
panic: close of closed channel [recovered]
panic: close of closed channel
goroutine 34 [running]:
testing.tRunner.func1.2({0x1054d1040, 0x105582c78})
/Users/hys/.gvm/gos/go1.19.3/src/testing/testing.go:1396 +0x1c8
testing.tRunner.func1()
/Users/hys/.gvm/gos/go1.19.3/src/testing/testing.go:1399 +0x378
panic({0x1054d1040, 0x105582c78})
/Users/hys/.gvm/gos/go1.19.3/src/runtime/panic.go:884 +0x204
github.com/apache/pulsar-client-go/pulsar/internal.(*connectionPool).Close(0x14000281080)
/Users/hys/.gvm/pkgsets/go1.19.5/global/pkg/mod/github.com/apache/[email protected]/pulsar/internal/connection_pool.go:128
+0x88
github.com/apache/pulsar-client-go/pulsar.(*client).Close(0x14000469960)
/Users/hys/.gvm/pkgsets/go1.19.5/global/pkg/mod/github.com/apache/[email protected]/pulsar/client_impl.go:259
+0x40
go.planetmeican.com/nerds/mq/test/close-panic_test.TestPanic(0x14000292680)
/Users/hys/Documents/dev/go-workspace/src/go.planetmeican.com/nerds/mq/test/close-panic/panic_test.go:21
+0x18c
testing.tRunner(0x14000292680, 0x10557f898)
/Users/hys/.gvm/gos/go1.19.3/src/testing/testing.go:1446 +0x10c
created by testing.(*T).Run
/Users/hys/.gvm/gos/go1.19.3/src/testing/testing.go:1493 +0x300
```
#### System configuration
**Pulsar version**: v2.10.3
**SDK version**: v0.10.0
--
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]