TestIntegrationKill sometimes times out waiting for the killed user's QUIT #205

Closed
opened 2026-10-27 08:28:46 +01:00 by clawbot · 1 comment
Collaborator

TestIntegrationKill in internal/ircserver/integration_test.go failed once in 27 runs during the review of #204. After the KILL, alice waited the test's 5 seconds for bob's QUIT and timed out. It did not fail in 21 runs on next, which is too few to tell the two apart. Requests on that host took milliseconds, and the IRC relay also polls on a timer, so a slow machine alone is an unlikely cause. A rare hang in the IRC listener, in delivering the QUIT or in closing the killed connection, is more likely. If so, a real IRC user could see a killed user stay in a channel. A test that fails at random also makes next red at random.

Fix: find what can hold up the QUIT that a KILL sends to the victim's channels, or the victim's disconnect, for more than 5 seconds, and fix that cause. Do not lengthen the test's wait or retry the test.

Definition of done

  1. The cause is named in the PR body in one or two plain sentences, with the code it is in.
  2. The fix removes it. If the cause is in the test and not in the server, the PR shows that and fixes the test.
  3. TestIntegrationKill passes in at least 50 runs in a row under -race while the host is busy, run through script/ with the count raised in a throwaway copy, not committed.
  4. One reviewed PR against next.

Model: opus-5-5

`TestIntegrationKill` in `internal/ircserver/integration_test.go` failed once in 27 runs during the review of https://git.eeqj.de/sneak/neoirc/pulls/204. After the `KILL`, alice waited the test's 5 seconds for bob's `QUIT` and timed out. It did not fail in 21 runs on `next`, which is too few to tell the two apart. Requests on that host took milliseconds, and the IRC relay also polls on a timer, so a slow machine alone is an unlikely cause. A rare hang in the IRC listener, in delivering the `QUIT` or in closing the killed connection, is more likely. If so, a real IRC user could see a killed user stay in a channel. A test that fails at random also makes `next` red at random. Fix: find what can hold up the `QUIT` that a `KILL` sends to the victim's channels, or the victim's disconnect, for more than 5 seconds, and fix that cause. Do not lengthen the test's wait or retry the test. ## Definition of done 1. The cause is named in the PR body in one or two plain sentences, with the code it is in. 2. The fix removes it. If the cause is in the test and not in the server, the PR shows that and fixes the test. 3. `TestIntegrationKill` passes in at least 50 runs in a row under `-race` while the host is busy, run through `script/` with the count raised in a throwaway copy, not committed. 4. One reviewed PR against `next`. Model: opus-5-5
Author
Collaborator

Fixed in #206. When bob's connection ended while his relay was reading its queue, the cancelled query made the database pool close its only connection. That deleted the tests' in-memory database, so alice never got the QUIT. The relay now finishes that read before it stops.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/neoirc/pulls/206. When bob's connection ended while his relay was reading its queue, the cancelled query made the database pool close its only connection. That deleted the tests' in-memory database, so alice never got the `QUIT`. The relay now finishes that read before it stops. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/neoirc#205