Golang: http2 and TLS handshake errors

Daniele B picture Daniele B · Sep 17, 2016 · Viewed 8.6k times · Source

I have a Go application with both http (on port 80) and https (on port 443) enabled.

I keep getting lots of these 3 kinds of error:

  • http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface

  • http: TLS handshake error from 151.38.29.250:44235: EOF

  • http: TLS handshake error from 2.239.197.163:6742: read tcp x.xxx.xxx.xxx:443->2.239.197.163:6742: i/o timeout

can anyone explain what these refer to?

Note that: all these requests are coming from mobile browsers (on Android and iOS devices)

Answer

Frederik Deweerdt picture Frederik Deweerdt · Sep 17, 2016
http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface

This means that the client failed to send the http2 connection preface (https://tools.ietf.org/html/rfc7540#section-3.5) before the server timed out.

http: TLS handshake error from 151.38.29.250:44235: EOF

This means that while the server and the client were performing the TLS handshake, the server saw the connection being closed, aka EOF.

http: TLS handshake error from 2.239.197.163:6742: read tcp x.xxx.xxx.xxx:443->2.239.197.163:6742: i/o timeout

This means that while the server was waiting to read from the client during the TLS handshake, the client didn't send anything before closing the connection.

As @JimB pointed out, those are perfectly normal to see. If you think the timeouts are kicking in too soon, you can define custom ones by defining a custom net.http.Transport: https://golang.org/pkg/net/http/#Transport, and set higher values for timeouts.