Skip to content

flake: TestOneWayWebSocketEventSender (heartbeat ping) #1521

@flake-investigator

Description

@flake-investigator

CI Run: https://github.com/coder/coder/actions/runs/25447780991
Job: test-go-pg-17 (failed at 2026-05-06T16:45:04Z)
Commit: 6a200a49d376be92f0081df9bdd874e55aee6a39 (dylanhuff-at-coder) coder/coder@6a200a4

Failure:

=== FAIL: coderd/httpapi TestOneWayWebSocketEventSender/Sends_a_heartbeat_to_the_socket_on_a_fixed_internal_of_time_to_keep_connections_alive (15.00s)
    t.go:120: 2026-05-06 16:40:33.435 [erro]  failed to heartbeat ping ...
        error= failed to ping:
               github.com/coder/coder/v2/coderd/httpapi.pingWithTimeout
                   /home/runner/work/coder/coder/coderd/httpapi/websocket.go:65
             - failed to ping: failed to write control frame opPing: failed to write frame: failed to flush: http: request method or response status code does not allow body
         *** slogtest: log detected at level ERROR; TEST FAILURE ***
--- FAIL: TestOneWayWebSocketEventSender/Sends_a_heartbeat_to_the_socket_on_a_fixed_internal_of_time_to_keep_connections_alive

Other failures in same run:

  • enterprise/cli TestFeaturesList/Table
  • enterprise/cli TestFeaturesList/JSON
  • enterprise/cli TestFeaturesList (parent)
    (These reported as FAIL but no assertion output showed up in logs.)

Notes / error analysis:

  • The heartbeat ping in HeartbeatClose errored with failed to flush: http: request method or response status code does not allow body, which is logged at ERROR level and causes slogtest to fail the subtest.
  • This suggests the ping write path is attempting to flush through the mocked ResponseRecorder after the WebSocket handshake (status 101), which intermittently returns the “response status code does not allow body” error.
  • No data race, panic, or OOM indicators found in logs.

Assignment analysis:

  • Unable to run git blame in this environment; used recent commit history instead.
  • Recent commits touching coderd/httpapi/websocket.go: 8714aa4637cc8e85f4ab29a80a364d8a6115d1a2, 2d7dd7310613f02010317d3db5b29edbf656f2fe, 612aae25235928f196539c895c3e856d1d6a3c6e (all Cian Johnston).
  • Recent commits touching coderd/httpapi/httpapi_test.go: 612aae25235928f196539c895c3e856d1d6a3c6e (adds slogtest logger).

Related issues:

Suggested fix direction:

  • Ensure ping writes don’t route through the httptest.ResponseRecorder after the WebSocket handshake in mockOneWaySocketWriter, or adjust HeartbeatClose to treat this flush error as a non-error for this test.

Reproduction:

  • Not yet determined (single CI failure).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions