Skip to content
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

Merged
merged 2 commits into from
Sep 23, 2024
Merged

Conversation

patrobinson
Copy link
Contributor

@patrobinson patrobinson commented Sep 23, 2024

Description

Work around a Go bug in HTTP/2 on Linux.

Context

Various reports of connection failures.

Steps to reproduce:

  1. Launch the agent on a linux machine
  2. Obtain the source ports being used using netstat -anp
  3. Block traffic destined for the agent source ports 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 restored

Observed behaviour:

The agent hangs for a long period of time (>3 minutes) and continuosly prints errors communicating with the agent backend:

2024-09-23 12:44:54 ERROR  HTTP Timing Trace uri=https://agent.buildkite.com/v3/ping method=GET hostPort=agent.buildkite.com:443 getConn=38.959µs gotConn=40.126µs reused=true idle=false idleTime=0s localAddr=198.19.249.69:42018 wroteHeaders=127.044µs wroteRequest=128.753µs
2024-09-23 12:44:54 WARN   ubuntu Failed to ping: Get "https://agent.buildkite.com/v3/ping": net/http: request canceled (Client.Timeout exceeded while awaiting headers) (Last successful was 13m0.810827775s ago)

Changes

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go fmt ./...)

@DrJosh9000 DrJosh9000 force-pushed the fix-agent-lost-when-using-http2 branch 5 times, most recently from 0a52fff to ad947e8 Compare September 23, 2024 06:22
@DrJosh9000 DrJosh9000 force-pushed the fix-agent-lost-when-using-http2 branch from ad947e8 to e407ac3 Compare September 23, 2024 06:40
@DrJosh9000 DrJosh9000 changed the title Attempt to workaround https://github.com/golang/go/issues/59690 Attempt to workaround golang/go#59690 Sep 23, 2024
@DrJosh9000 DrJosh9000 marked this pull request as ready for review September 23, 2024 06:42
Copy link
Contributor Author

@patrobinson patrobinson left a 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 {
Copy link
Contributor Author

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?

Copy link
Contributor

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.

@DrJosh9000 DrJosh9000 changed the title Attempt to workaround golang/go#59690 Work around golang/go#59690 Sep 23, 2024
Copy link
Contributor

@DrJosh9000 DrJosh9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrobinson patrobinson merged commit 859859b into main Sep 23, 2024
1 check passed
@patrobinson patrobinson deleted the fix-agent-lost-when-using-http2 branch September 23, 2024 07:03
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants