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
net/http: setting only WriteTimeout doesn't work #4741
Labels
Milestone
Comments
Here's something a bit less wordy: http://play.golang.org/p/PrWv-5KPvJ note that as soon as you set a read and write timeout, it times out based on the read timeout. |
with only a write timeout, goroutines look like this long after the request handler has returned: goroutine 1 [chan receive]: net.(*pollServer).WaitRead(0xc20008a990, 0xc2000b90d0, 0xc20008a300, 0xb, 0xc20008a301, ...) /home/alberts/go/src/pkg/net/fd_unix.go:237 +0x63 net.(*netFD).accept(0xc2000b90d0, 0x44c080, 0x0, 0xc20008a300, 0xb, ...) /home/alberts/go/src/pkg/net/fd_unix.go:621 +0x172 net.(*TCPListener).AcceptTCP(0xc20009c258, 0xc20008ac30, 0x0, 0x0, 0x8, ...) /home/alberts/go/src/pkg/net/tcpsock_posix.go:232 +0x62 net.(*TCPListener).Accept(0xc20009c258, 0x0, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/net/tcpsock_posix.go:242 +0x49 net/http.(*Server).Serve(0xc2000a8400, 0xc2000a83c0, 0xc20009c258, 0x0, 0x0, ...) /home/alberts/go/src/pkg/net/http/server.go:1259 +0x84 main.main() /home/alberts/bork.go:39 +0x175 goroutine 3 [syscall]: syscall.Syscall6() /home/alberts/go/src/pkg/syscall/asm_linux_amd64.s:40 +0x5 syscall.EpollWait(0x6, 0xc2000ba010, 0xa, 0xa, 0xffffffffffffffff, ...) /home/alberts/go/src/pkg/syscall/zerrors_linux_amd64.go:1871 +0x98 net.(*pollster).WaitFD(0xc2000ba000, 0xc20008a990, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/net/fd_linux.go:146 +0x12a net.(*pollServer).Run(0xc20008a990, 0x0) /home/alberts/go/src/pkg/net/fd_unix.go:205 +0x10d created by net.newPollServer /home/alberts/go/src/pkg/net/newpollserver_unix.go:33 +0x307 goroutine 4 [syscall]: syscall.Syscall6() /home/alberts/go/src/pkg/syscall/asm_linux_amd64.s:40 +0x5 syscall.EpollWait(0xa, 0xc2000ba0c0, 0xa, 0xa, 0xffffffffffffffff, ...) /home/alberts/go/src/pkg/syscall/zerrors_linux_amd64.go:1871 +0x98 net.(*pollster).WaitFD(0xc2000ba0b0, 0xc20008ab10, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/net/fd_linux.go:146 +0x12a net.(*pollServer).Run(0xc20008ab10, 0x0) /home/alberts/go/src/pkg/net/fd_unix.go:205 +0x10d created by net.newPollServer /home/alberts/go/src/pkg/net/newpollserver_unix.go:33 +0x307 goroutine 5 [chan receive]: net.(*pollServer).WaitRead(0xc20008ab10, 0xc2000b9270, 0xc20008a300, 0xb, 0xffffffffffffff01, ...) /home/alberts/go/src/pkg/net/fd_unix.go:237 +0x63 net.(*netFD).Read(0xc2000b9270, 0xc2000cb000, 0x1000, 0x1000, 0x0, ...) /home/alberts/go/src/pkg/net/fd_unix.go:431 +0x2eb net.(*conn).Read(0xc20009c298, 0xc2000cb000, 0x1000, 0x1000, 0x7fdcab9d3ea0, ...) /home/alberts/go/src/pkg/net/net.go:123 +0xc6 net/http.(*switchReader).Read(0xc2000c1028, 0xc2000cb000, 0x1000, 0x1000, 0x107804a8, ...) /home/alberts/go/src/pkg/net/http/server.go:192 +0x94 io.(*LimitedReader).Read(0xc20007a820, 0xc2000cb000, 0x1000, 0x1000, 0x0, ...) /home/alberts/go/src/pkg/io/io.go:411 +0xc3 bufio.(*Reader).fill(0xc2000ad2a0, 0x0) /home/alberts/go/src/pkg/bufio/bufio.go:79 +0x10c bufio.(*Reader).ReadSlice(0xc2000ad2a0, 0x10000a, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/bufio/bufio.go:262 +0x205 bufio.(*Reader).ReadLine(0xc2000ad2a0, 0x0, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/bufio/bufio.go:294 +0x63 net/textproto.(*Reader).readLineSlice(0xc20008ae70, 0xc2000b9ea0, 0x61b9e8, 0xc200000001) /home/alberts/go/src/pkg/net/textproto/reader.go:55 +0x51 net/textproto.(*Reader).ReadLine(0xc20008ae70, 0xc2000b9ea0, 0xc2000a8800, 0x4103a6) /home/alberts/go/src/pkg/net/textproto/reader.go:36 +0x25 net/http.ReadRequest(0xc2000ad2a0, 0xc2000b9ea0, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/net/http/request.go:478 +0xa6 net/http.(*conn).readRequest(0xc2000c1000, 0xc2000a8800, 0x0, 0x0, 0x0, ...) /home/alberts/go/src/pkg/net/http/server.go:421 +0xaf net/http.(*conn).serve(0xc2000c1000, 0x0) /home/alberts/go/src/pkg/net/http/server.go:790 +0x11d created by net/http.(*Server).Serve /home/alberts/go/src/pkg/net/http/server.go:1287 +0x36d |
fullung, thanks! Great example. Will fix. Owner changed to @bradfitz. Status changed to Accepted. |
https://golang.org/cl/7301043 Status changed to Started. |
This issue was closed by revision d1e16d0. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: