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

Read timeout for netutils.timeoutConn in new Go versions does not work #229

Open
ironsmile opened this issue Mar 27, 2019 · 0 comments
Open
Labels

Comments

@ironsmile
Copy link
Owner

ironsmile commented Mar 27, 2019

In current versions of Go (1.11, 1.12) startBackgroundRead in server.go always sets ReadDeadline to the zero time. The code in question:

func (cr *connReader) startBackgroundRead() {
	cr.lock()
	defer cr.unlock()
	if cr.inRead {
		panic("invalid concurrent Body.Read call")
	}
	if cr.hasByte {
		return
	}
	cr.inRead = true
	cr.conn.rwc.SetReadDeadline(time.Time{}) // <----- Line in question
	go cr.backgroundRead()
}

This makes the the ReadDeadline to be some strange number in our implementation, possibly negative. Which the TCP server treats as "I should close this connection". This in turn makes all such connections unusable.

We should make sure there is no possible code path where SetDeadline, SetReadDeadline and SetWriteDeadline of our timeoutConn would case the connection to be closed prematurely.

@ironsmile ironsmile added the bug label Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant