Fix ci failure issue#46
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the TestNetAcceptedIsMonotonic test in observability_connection_metrics_test.h to prevent race conditions on slow CI runners. Instead of immediately closing the socket after connecting, the test now sends a full HTTP request and drains the response before closing the connection. Additionally, the polling deadline has been increased from 2 seconds to 5 seconds. I have no feedback to provide as there are no review comments.
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.
Fix flaky
ObsConnMetrics: net.connections.accepted monotonicon slow CI runnersCloses #45.
Summary
TestNetAcceptedIsMonotonicintest/observability/observability_connection_metrics_test.hwas failing intermittently on GitHub Actions shared runners withdelta=4.000000 expected>=5. The test opened 5 TCP connections in a tight loop with immediateclose()and a 20 ms inter-connection sleep, then polled the accepted counter for up to 2 s.On slow / contended runners one of the
connect+closecycles completed before the accept dispatcher processed the connection — the TCP RST arrived before (or nearly simultaneously with) the accept callback that incrementsreactor.net.connections.accepted. The counter only reached 4 and the test failed.Fix
Replace the bare
connect → closeloop withconnect → send GET /h → drain response → close(Option 2 from the issue). Driving a full HTTP request/response cycle per connection forces the accept callback to complete before the close, making the +1 deterministic instead of timing-dependent.The post-loop snapshot poll deadline is also bumped from 2 s to 5 s as a backstop for the small dispatcher-thread visibility gap between the response draining on the client side and the
Snapshot()picking up the counter bump.The
Connection: closerequest header keeps each connection short-lived so the test still exercises the accept-counter path under repeated open/close (which was the original intent), without changing the assertion shape (delta >= N).Changes
test/observability/observability_connection_metrics_test.h—TestNetAcceptedIsMonotonicnow sends a minimal HTTP request and drains the response on each of the N connections; poll deadline raised from 2 s → 5 s; stale "accept-time +1 fires regardless of any later HTTP traffic" comment replaced with the actual race rationale.No production code changed. Test-only fix, ~15-line diff in a single file.
Test plan
make -j4 test_runner— clean build../test_runner obs_connection_metrics× 20 — all 20 runs pass ([PASS] ObsConnMetrics: net.connections.accepted monotonic over N opens).obs_connection_metricsmembership in the existing all-suites jobs).Notes for reviewer
DrainSocket(fd, 500)call is a 500 ms ceiling, not a fixed sleep — it returns as soon as the response bytes arrive, so the per-connection cost on a healthy runner is microseconds, not 500 ms.TestFramework::RecordTestcovers any exception escapes fromSendAll/DrainSocket; the explicitsend failedshort-circuit just gives a more diagnostic failure message than a generic catch.