go-zookeeper/zk

Why clear timeout when read a response from server?

opriz opened this issue · 3 comments

opriz commented

I found this line in conn.go

https://github.com/samuel/go-zookeeper/blob/master/zk/conn.go#L717
or
https://github.com/go-zookeeper/zk/blob/master/conn.go#L654
c.conn.SetReadDeadline(time.Time{})

In my view, if there occurs a problem in the network or server, clear the timeout deadline may cause this goroutine stuck for a long time even forever.

I wonder why it was written like this, was there some reason I've missed it?
If necessary, I'd like to post an mr.

Good question. I can only think it's to try to leave the connection open between operations, but the people maintaining this fork didn't write that code. If it can be safely removed, a PR is welcome but we should make sure that nothing breaks.

Need to reproduce an issue (hopefully with a test case) and fix this.