-
Notifications
You must be signed in to change notification settings - Fork 147
Closed
Labels
kind/bugSomething isn't workingSomething isn't working
Description
What happened:
Panic occurred when the context is canceled:
E0503 19:14:23.280014 19253 retrywatcher.go:130] "Watch failed" err="context canceled"
panic: send on closed channel
goroutine 324 [running]:
github.com/stern/stern/stern.Run.func3()
/home/runner/go/pkg/mod/github.com/stern/stern@v1.23.0/stern/stern.go:190 +0x1aa
created by github.com/stern/stern/stern.Run
/home/runner/go/pkg/mod/github.com/stern/stern@v1.23.0/stern/stern.go:179 +0xcea
What you expected to happen:
Not to panic when the context is canceled
How to reproduce it (as minimally and precisely as possible):
Initialize stern.Config
and run the following:
ctx := context.WithCancel(context.Background())
go func() {
<-time.After(5 * time.Second)
cancel()
}()
stern.Run(ctx, config)
Anything else we need to know?:
There is actually a race condition so the described bug doesn't always occur. It happens because the error channel is closed without waiting for go routine to finish
Environment:
- stern version (use
stern --version
): - OS (e.g:
cat /etc/os-release
): - Install tools (e.g: Homebrew)
- Others:
IamShobe
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working