Repository navigation
Wait for the Agent's greeting to end before two server tests count statements or hang up - #295
Merged
Merged
Conversation
…atements or hang up Two server tests raced the connection's own greeting and failed in CI about every other run: - a_reconnecting_agent_is_told_what_the_server_holds counted the statements of monitors::greeting right after reading set_monitors from the socket. The connection's task reads the device once more after sending that (updates::publish_device), and that read landed in the count: 5 statements instead of 4. - an_agent_that_goes_offline_to_update_shows_as_updating said it was updating and hung up 100 ms later. A connection that is still greeting when the socket closes fails a send and never reads what the Agent said, so the device showed as offline instead of updating. Both now wait for the last message of the greeting (common::greeted) first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two server tests raced the Agent connection's own greeting. They are the only server tests that failed a first attempt in CI over the last 200 runs, and one of them failed the 0.5.0 release run.
a_reconnecting_agent_is_told_what_the_server_holds(4 failures, 3 of them on 2026-11-20) counted the statements ofmonitors::greetingright after readingset_monitorsfrom the socket. The connection's task reads the device once more after sending that (updates::publish_deviceat the end ofgreet), and under load that read landed in the count:(5, 0)instead of(4, 0), on either backend.an_agent_that_goes_offline_to_update_shows_as_updating(2 failures, 2026-11-10 and 11-11) said it was updating and hung up 100–200 ms later. A connection that is still greeting when the socket closes fails a send and never enters the loop that reads what the Agent said, so the device showed as offline (updating_tonull) instead of updating.Both now wait for the last message of the greeting first, through a new
common::greeted(the thumbnail interval is the last thing a new connection is sent). Test-only; the server is unchanged.How it was checked. Looping the unfixed monitors test alone 55 times never failed, so the race needs the whole binary's load. To prove the cause, a scratch server build (not in this PR) ran 300 reads 1 ms apart just before
publish_device:main(5, 0)vs(4, 0)Nullvs"1.2.3"Those are the CI failures' exact messages.
cargo fmt --checkpasses; the server suite's full run is CI's.