-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Work around golang/go#59690 #3005
Conversation
0a52fff
to
ad947e8
Compare
ad947e8
to
e407ac3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't approve this but it LGTM
if err != nil { | ||
l.Warn("Failed to configure HTTP2 transports: %v", err) | ||
} | ||
if tr2 != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this incase err != nil
? Should we just make this an else to the previous conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that writing it this way emphasises that each return arg is its own value, whereas if err != nil { ... } else { ... }
makes an assumption about when the returns are nil or not. In this case either would probably be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
Description
Work around a Go bug in HTTP/2 on Linux.
Context
Various reports of connection failures.
Steps to reproduce:
netstat -anp
iptables -I INPUT -p tcp --dport $PORT -j DROP
Expected behaviour:
After the initial connection times out a new connection is established. The old connections no longer show as
ESTABLISHED
and communications to agent.buildkite.com are restoredObserved behaviour:
The agent hangs for a long period of time (>3 minutes) and continuosly prints errors communicating with the agent backend:
Changes
http2.ConfigureTransports
to gain access toReadIdleTimeout
, and set it to a nice low 30s, as documented in x/net/http2: raciness in stream close prevents closing of failed connections, blocking subsequent requests golang/go#59690 (comment).authenticatedTransport
. Getting rid ofauthenticatedTransport
is too much hassle right now, but we can take inspiration from https://github.com/golang/oauth2/blob/master/transport.go#L20.Testing
go test ./...
). Buildkite employees may check this if the pipeline has run automatically.go fmt ./...
)