Repository navigation
[Fix] Give the multicast liveness probe its own timeout option - #16552
Open
SiriusTL666 wants to merge 1 commit into
Open
SiriusTL666 wants to merge 1 commit into
SiriusTL666 wants to merge 1 commit into
Conversation
Follow-up to apache#16542, addressing the two points raised there. The probe reused the registry url's generic `timeout` parameter, which defaults to 1000 ms and governs unrelated registry operations such as listener.wait. Reusing it means the two cannot be tuned independently: raising `timeout` to give the probe more slack also changes how long other operations wait, and lowering it for something else silently tightens the probe. The probe now reads a dedicated `clean.check.timeout` on the registry url, defaulting to the same 1000 ms, so existing deployments behave exactly as after apache#16542. The regression test measured elapsed time against TEST-NET-1 (192.0.2.1). That passes without the timeout wherever the connect fails immediately, for example no route to host or a firewall that rejects rather than drops, so it did not actually prove the timeout was applied - exactly the failure mode a timing assertion has. It now captures the constructed Socket and asserts the exact value handed to connect(), which is platform independent. The interrupt test is mocked the same way so it no longer depends on routing either. The slow-provider trade-off is also documented on the field: a provider that is merely slow to accept within the budget is treated as expired. That is the intended behaviour of a liveness probe, but it belongs in the code that decides it, not only in review comments. Verified by running the module tests (18 pass) and by reverting the option: the configured-timeout test fails with the shared key in place.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16552 +/- ##
============================================
+ Coverage 59.87% 60.95% +1.07%
- Complexity 11745 11763 +18
============================================
Files 1953 1953
Lines 89259 89278 +19
Branches 13393 13475 +82
============================================
+ Hits 53446 54420 +974
+ Misses 30282 29271 -1011
- Partials 5531 5587 +56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Follow-up to #16542, covering the two non-blocking points from the review.
1. The probe gets its own timeout option
The probe read the registry url's generic
timeout, which defaults to 1000 ms and also governs unrelated registry operations such aslistener.wait. Sharing one parameter means the two cannot be tuned independently: raisingtimeoutto give the probe more slack also changes how long other registry operations wait, and lowering it for something else silently tightens the probe.The probe now reads
clean.check.timeouton the registry url (not the provider url — the budget belongs to the registry doing the cleaning), defaulting to the same 1000 ms. Existing deployments behave exactly as they do after #16542, so this is a separable improvement rather than a behaviour change.2. The regression test no longer depends on the network
You were right that the timing test was weak. Asserting elapsed time against TEST-NET-1 passes without the timeout wherever the connect fails immediately — no route to host, or a firewall that rejects rather than drops — so in those environments it proved nothing. That is the general failure mode of timing assertions, not just this one.
The test now captures the constructed
Socketand asserts the exact value passed toconnect(), which is platform independent. I verified it actually catches the regression: switching back to the sharedtimeoutkey makes it fail. The interrupt test is mocked the same way, so it no longer depends on routing either.There are now three cases: the configured value reaches
connect(), the default applies when nothing is configured, and a provider that accepts connections is not expired.3. The slow-provider trade-off, documented in code
Point (1) in your review — a provider that accepts more slowly than the budget is now treated as expired and unregistered — is the intended semantics of a liveness probe, but it was only recorded in the review thread. It is now in the field javadoc, where the next person to touch this will see it.
Verification
JDK 17,
dubbo-registry-multicast: 18/18 pass (MulticastRegistryTest17,MulticastRegistryFactoryTest1).spotless:applyclean.Reverse-verified: with the shared
timeoutkey restored,testLivenessProbePassesTheConfiguredTimeoutToConnectfails with the actual argument1000instead of250.I kept this separate from #16542 rather than reopening it, since that change is already merged and this one is independently reviewable. Happy to fold it into a different shape if you prefer.