unJASON opened a new issue, #1483:
URL: https://github.com/apache/pulsar-client-go/issues/1483
#### Expected behavior
no panic
#### Actual behavior
panic
#### Steps to reproduce
``` go
panic: sync: WaitGroup is reused before previous Wait has returned
goroutine 129942961 gp=0xc0127e4540 m=3 mp=0xc00006d008 [running]:
panic({0x12d3ae0?, 0x1792360?})
/home/jenkins/go1.25/src/runtime/panic.go:802 +0x168 fp=0xc002f1fe50
sp=0xc002f1fda0 pc=0x48ea28
sync.(*WaitGroup).Wait(0xc02b974378)
/home/jenkins/go1.25/src/sync/waitgroup.go:208 +0xf4 fp=0xc002f1fe78
sp=0xc002f1fe50 pc=0x4b01b4
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).failLeftRequestsWhenClose(0xc02b9742c0)
/home/jenkins/go/pkg/mod/github.com/apache/[email protected]/pulsar/internal/connection.go:378
+0x25 fp=0xc002f1feb8 sp=0xc002f1fe78 pc=0xc0c745
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).run(0xc02b9742c0)
/home/jenkins/go/pkg/mod/github.com/apache/[email protected]/pulsar/internal/connection.go:430
+0x3bf fp=0xc002f1ffc0 sp=0xc002f1feb8 pc=0xc0cc7f
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).start.func1()
/home/jenkins/go/pkg/mod/github.com/apache/[email protected]/pulsar/internal/connection.go:240
+0x65 fp=0xc002f1ffe0 sp=0xc002f1ffc0 pc=0xc0ba65
runtime.goexit({})
/home/jenkins/go1.25/src/runtime/asm_amd64.s:1693 +0x1
fp=0xc002f1ffe8 sp=0xc002f1ffe0 pc=0x4976a1
created by
github.com/apache/pulsar-client-go/pulsar/internal.(*connection).start in
goroutine 129886168
/home/jenkins/go/pkg/mod/github.com/apache/[email protected]/pulsar/internal/connection.go:236
+0x68
```
close connection while sending data demo code like this:
``` go
package main
import (
"fmt"
"sync"
"time"
)
func simulateConnectionFuncCall(wg *sync.WaitGroup) {
wg.Add(1)
time.Sleep(100 * time.Millisecond)
wg.Done()
}
func demoPanic(){
wg := &sync.WaitGroup{}
// one goroutine send something
go func(wg *sync.WaitGroup) {
for j:=0;j< 100;j++{
simulateConnectionFuncCall(wg)
}
}(wg)
time.Sleep(200*time.Millisecond)
// sync.(*WaitGroup).Wait panic(waitgroup.go:208)
wg.Wait()
fmt.Printf("done")
}
func main() {
//demo()
demoPanic()
return
}
```
#### System configuration
**Pulsar version**: 2.6.x
sdk version: 0.17.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]