Skip to content

fix: use a native websocket.NetConn for agent RPC client #13142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2024

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented May 3, 2024

One cause of #13139 is a peculiar failure mode of WebsocketNetConn which causes it to return context.Canceled in some circumstances when the underlying websocket fails. We have special processing for that error in the agent.run() routine, which is erroneously being triggered.

Since we don't actually need the returned context from WebsocketNetConn, we can simplify and just use the netConn from the websocket library directly.

Copy link
Contributor Author

spikecurtis commented May 3, 2024

// Set the read limit to 4 MiB -- about the limit for protobufs. This needs to be larger than
// the default because some of our protocols can include large messages like startup scripts.
conn.SetReadLimit(1 << 22)
netConn := websocket.NetConn(ctx, conn, websocket.MessageBinary)
Copy link
Member

Choose a reason for hiding this comment

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

Since this is no longer wrapped via custom closer below, there's a slight change in behavior, this will be used instead:

c.c.Close(StatusNormalClosure, "")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, but I don't think it matters in any meaningful way. The server doesn't act any differently based on the close code or message.

@spikecurtis spikecurtis force-pushed the spike/13139-handleOK-promise branch from 9392155 to 92f0f66 Compare May 3, 2024 10:31
@spikecurtis spikecurtis force-pushed the spike/13139-native-netcon branch 2 times, most recently from f684439 to ac491e5 Compare May 3, 2024 10:33
@spikecurtis spikecurtis force-pushed the spike/13139-handleOK-promise branch from 92f0f66 to 094ce97 Compare May 6, 2024 05:19
@spikecurtis spikecurtis force-pushed the spike/13139-native-netcon branch from ac491e5 to 505cd04 Compare May 6, 2024 05:19
@spikecurtis spikecurtis force-pushed the spike/13139-handleOK-promise branch from 094ce97 to 4e4c469 Compare May 6, 2024 10:22
@spikecurtis spikecurtis force-pushed the spike/13139-native-netcon branch from 505cd04 to c0536b6 Compare May 6, 2024 10:22
@spikecurtis spikecurtis force-pushed the spike/13139-handleOK-promise branch from 4e4c469 to 4ad81b0 Compare May 6, 2024 10:33
Base automatically changed from spike/13139-handleOK-promise to main May 6, 2024 10:47
@spikecurtis spikecurtis force-pushed the spike/13139-native-netcon branch from c0536b6 to 667b718 Compare May 6, 2024 10:49
Copy link
Contributor Author

spikecurtis commented May 6, 2024

Merge activity

  • May 6, 6:49 AM EDT: Graphite rebased this pull request as part of a merge.
  • May 6, 7:00 AM EDT: @spikecurtis merged this pull request with Graphite.

@spikecurtis spikecurtis merged commit e76b595 into main May 6, 2024
25 checks passed
@spikecurtis spikecurtis deleted the spike/13139-native-netcon branch May 6, 2024 11:00
@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants