go-zookeeper / zk

Native ZooKeeper client for Go
BSD 3-Clause "New" or "Revised" License
504 stars 130 forks source link

close watches in potential panics #145

Open mrkagelui opened 1 month ago

mrkagelui commented 1 month ago

looking at the recv loop goroutine (https://github.com/go-zookeeper/zk/blob/27bc0d6c39bb4e9d3c410057bf2c779f256ba15e/conn.go#L466-L482), 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?