Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close watches in potential panics #145

Open
mrkagelui opened this issue Jul 31, 2024 · 0 comments
Open

close watches in potential panics #145

mrkagelui opened this issue Jul 31, 2024 · 0 comments

Comments

@mrkagelui
Copy link

looking at the recv loop goroutine (

zk/conn.go

Lines 466 to 482 in 27bc0d6

go func() {
defer close(c.closeChan) // tell send loop to exit
defer wg.Done()
var err error
if c.debugCloseRecvLoop {
err = errors.New("DEBUG: close recv loop")
} else {
err = c.recvLoop(c.conn)
}
if err != io.EOF || c.logInfo {
c.logger.Printf("recv loop terminated: %v", err)
}
if err == nil {
panic("zk: recvLoop should never return nil error")
}
}()
), it seems that if somehow the goroutine panics, the watches (the open channels) are not closed, and hence the receiver won't know if the watches are still active, am I right? should we just add to the defers to close them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant