You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] ConnectionMonitorLogTest.connectAndDisconnectProduceMatchingLogEntries is flaky #124
ConnectionMonitorLogTest.connectAndDisconnectProduceMatchingLogEntries (jircd-integration-tests/src/test/java/net/jircd/integration/ConnectionMonitorLogTest.java:44) failed once in a full ./gradlew build on 2026-10-27, on the #121 branch (which changed no connection or logging code):
It passed when run alone right afterwards, and in two later full builds of the same tree (one with cleanTest). The assertion message wasn't kept, so we don't know which check failed.
Suspected cause (unverified)
The test attaches a LogCapture to the static ConnectionMonitorLog logger, then takes the first captured connection-event=connected line and the firstconnection-event=disconnected line, and asserts their connection tokens are equal. The capture isn't scoped to this test's server or connection. A connection from an earlier test that is still closing asynchronously could log its disconnected line into the capture first. The tokens would then differ, and the assertion at line 65 would fail. A slow machine hitting the 5 s awaitMessage timeout is another possibility.
Suggested fix
Await the disconnected line whose token matches this test's connected token, rather than the first disconnected line.
Optionally, also filter the connected line by this client's local port (remoteAddress=).
Keep the timeout failure message informative: on failure, include the captured lines in the assertion message.
Acceptance
The test only looks at log lines for its own connection.
Running the integration tests repeatedly, for example 20 runs of the class next to the other connection tests, shows no failures.
Activity