Skip to content

fix: send a valid WebSocket close code for missing agents - #3244

Open
patrick-andstar wants to merge 1 commit into
alibaba:masterfrom
patrick-andstar:fix/websocket-close-code
Open

fix: send a valid WebSocket close code for missing agents#3244
patrick-andstar wants to merge 1 commit into
alibaba:masterfrom
patrick-andstar:fix/websocket-close-code

Conversation

@patrick-andstar

Copy link
Copy Markdown

Summary

Send a valid private-use WebSocket close code when a tunnel client requests an unknown Arthas agent.

Related to #3187

Motivation

TunnelSocketFrameHandler constructs a CloseWebSocketFrame with status code 2000 when the requested agent is absent. Netty rejects 2000 under RFC 6455, so the client receives an internal exception instead of the intended missing-agent close frame and error message.

Changes

  • Replace the invalid close status code 2000 with valid private-use code 4000.
  • Add an EmbeddedChannel regression test for the missing-agent handshake path.

Tests

  • Docker Desktop, Maven 3.9.9 / Eclipse Temurin JDK 17: mvn -V -ntp -pl tunnel-server -am -Dtest=TunnelSocketFrameHandlerTest -Dsurefire.failIfNoSpecifiedTests=false test (1 test, 0 failures, 0 errors)

Notes

This change preserves the existing missing-agent behavior. It does not register an absent agent or claim to resolve unrelated tunnel registration failures.

Duplicate Check

Checked open pull requests for #3187 and WebSocket close-code terms. No pull request addressing this invalid close status was found.

@CLAassistant

CLAassistant commented Jul 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants