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

net/http: setting only WriteTimeout doesn't work #4741

Closed
alberts opened this issue Feb 1, 2013 · 7 comments
Closed

net/http: setting only WriteTimeout doesn't work #4741

alberts opened this issue Feb 1, 2013 · 7 comments
Milestone

Comments

@alberts
Copy link
Contributor

alberts commented Feb 1, 2013

What steps will reproduce the problem?

https://groups.google.com/forum/#!topic/golang-nuts/vBvpMSJeezc/discussion

https://gist.github.com/4640746

https://groups.google.com/d/msg/golang-dev/kBs0SukpP9g/gubrOODIoywJ

What do you see instead?

request never times out

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

linux

Which version are you using?  (run 'go version')

go version devel +f50a112bfe3b Fri Jan 25 10:06:18 2013 +1100 linux/amd64
@bradfitz
Copy link
Contributor

bradfitz commented Feb 1, 2013

Comment 1:

Can you write a minimal test?
The current gist is like a "my program doesn't work", but I'm not exactly sure what
you're trying to illustrate.
Like, something without a "chanBreaker" or http.CloseNotifier or a "gg".

Status changed to WaitingForReply.

@alberts
Copy link
Contributor Author

alberts commented Feb 1, 2013

Comment 2:

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.

@alberts
Copy link
Contributor Author

alberts commented Feb 1, 2013

Comment 3:

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

@bradfitz
Copy link
Contributor

bradfitz commented Feb 4, 2013

Comment 4:

fullung, thanks!  Great example.
Will fix.

Owner changed to @bradfitz.

Status changed to Accepted.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 4, 2013

Comment 5:

Labels changed: added priority-soon, go1.1, removed priority-triage, go1.1maybe.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 5, 2013

Comment 6:

https://golang.org/cl/7301043

Status changed to Started.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 5, 2013

Comment 7:

This issue was closed by revision d1e16d0.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants