Skip to content

net/http: empty responses with chunked transfer-encoding cause future requests to fail #8648

Closed
@gopherbot

Description

@gopherbot

by eyakubovich:

What does 'go version' print?

go version go1.3.1 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Run a server that closes a connection by timeout: http://play.golang.org/p/qfkdd6hDat
2. Run the client: http://play.golang.org/p/hxTAdcdrOY

What happened?

The first request succeeds (get empty body) but subsequent requests intermittently fail.
Client output:

2014/09/03 17:53:56 []
2014/09/03 17:53:56 resp err= Get http://localhost/foo: EOF
2014/09/03 17:53:57 []
2014/09/03 17:53:57 resp err= Get http://localhost/foo: EOF
2014/09/03 17:53:58 []
2014/09/03 17:53:58 resp err= Get http://localhost/foo: EOF
2014/09/03 17:53:59 []
2014/09/03 17:53:59 resp err= Get http://localhost/foo: http: can't write HTTP request
on broken connection
2014/09/03 17:54:00 []
2014/09/03 17:54:00 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:01 []
2014/09/03 17:54:01 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:02 []
2014/09/03 17:54:02 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:03 []
2014/09/03 17:54:03 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:04 []
2014/09/03 17:54:04 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:05 body err= unexpected EOF
2014/09/03 17:54:06 []
2014/09/03 17:54:06 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:07 []
2014/09/03 17:54:07 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:08 []
2014/09/03 17:54:08 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:09 body err= unexpected EOF
2014/09/03 17:54:10 body err= unexpected EOF
2014/09/03 17:54:11 []
2014/09/03 17:54:11 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:12 body err= unexpected EOF
2014/09/03 17:54:13 []
2014/09/03 17:54:13 resp err= Get http://localhost/foo: EOF
2014/09/03 17:54:14 body err= unexpected EOF
2014/09/03 17:54:15 []


What should have happened instead?
- Subsequent requests should behave identically by returning empty body.
- Note that the server may have closed the connection abruptly. That can result in
resp.Body.Read() failing. However the Get() should not fail with EOF.


Please provide any additional information below.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions