EOF error when there is a GOAWAY response
Closed this issue · 7 comments
Maybe an error here should fall back to the status code error path:
https://github.com/RobotsAndPencils/buford/blob/master/push/service.go#L184
@groob is investigating this issue.
https://github.com/golang/net/blob/master/http2/transport.go#L1592
Here's the full response from GODEBUG=http2debug=2
2016/03/03 11:36:06 http2: Transport failed to get client conn for api.push.apple.com:443: http2: no cached connection was available
2016/03/03 11:36:06 http2: Transport creating client conn to 17.172.234.15:443
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: wrote SETTINGS len=18, settings: ENABLE_PUSH=0, INITIAL_WINDOW_SIZE=4194304, MAX_HEADER_LIST_SIZE=10485760
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: wrote WINDOW_UPDATE len=4 (conn) incr=1073741824
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: read SETTINGS len=24, settings: HEADER_TABLE_SIZE=4096, MAX_CONCURRENT_STREAMS=500, MAX_FRAME_SIZE=16384, MAX_HEADER_LIST_SIZE=8000
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: wrote SETTINGS flags=ACK len=0
2016/03/03 11:36:06 Unhandled Setting: [HEADER_TABLE_SIZE = 4096]
2016/03/03 11:36:06 Unhandled Setting: [MAX_HEADER_LIST_SIZE = 8000]
2016/03/03 11:36:06 http2: Transport encoding header ":authority" = "api.push.apple.com"
2016/03/03 11:36:06 http2: Transport encoding header ":method" = "POST"
2016/03/03 11:36:06 http2: Transport encoding header ":path" = "/3/device/xxx"
2016/03/03 11:36:06 http2: Transport encoding header ":scheme" = "https"
2016/03/03 11:36:06 http2: Transport encoding header "content-type" = "application/json"
2016/03/03 11:36:06 http2: Transport encoding header "content-length" = "46"
2016/03/03 11:36:06 http2: Transport encoding header "accept-encoding" = "gzip"
2016/03/03 11:36:06 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: wrote HEADERS flags=END_HEADERS stream=1 len=132
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: wrote DATA stream=1 len=46 data="{\"mdm\":\"\"}"
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: wrote DATA flags=END_STREAM stream=1 len=0 data=""
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: read GOAWAY len=46 LastStreamID=0 ErrCode=NO_ERROR Debug="{\"reason\":\"BadCertificateEnvironment\"}"
2016/03/03 11:36:06 http2: Transport received GOAWAY len=46 LastStreamID=0 ErrCode=NO_ERROR Debug="{\"reason\":\"BadCertificateEnvironment\"}"
2016/03/03 11:36:06 http2: Framer 0xc8204e9800: read GOAWAY len=8 LastStreamID=0 ErrCode=NO_ERROR Debug=""
2016/03/03 11:36:06 http2: Transport received GOAWAY len=8 LastStreamID=0 ErrCode=NO_ERROR Debug=""
2016/03/03 11:36:06 Transport readFrame error: (*errors.errorString) EOF
2016/03/03 11:36:06 RoundTrip failure: unexpected EOF
Looking at net/http
it appears that Debug information from GoAway frames is not returned, but I'm not sure there's an issue here because the apns server is actually returning a NO_ERROR status.
I'm not sure either. http://tools.ietf.org/html/rfc7540
Reproduced the issue here using a development (sandbox) certificate against the production environment.
buford/example/push
❯ GODEBUG=http2debug=2 go run main.go -c cert.p12 -d device-token -e production
- Using just any old self-signed certificate doesn't trigger the same error.
- The device token doesn't need to be valid in this case because it doesn't get that far.
// TODO: deal with GOAWAY more. particularly the error code
https://github.com/golang/net/blob/master/http2/transport.go#L1489
There is a fix to x/net/http2 that should resolve this issue (I need to test it to double check).
Well, it doesn't give an EOF after updating, but still not the error from Apple.
go get -u golang.org/x/net/http2