Skip to content

[Backport release-1.19] fix(clients): give each sidecar health check attempt a timeout - #1270

Merged
dapr-bot merged 5 commits into
release-1.19from
backport-1241-to-release-1.19
Oct 15, 2026
Merged

dapr-bot merged 5 commits into
release-1.19from
backport-1241-to-release-1.19

Conversation

@dapr-bot

Copy link
Copy Markdown
Collaborator

Backport b14b283 from #1241.

* fix(health): bound each sidecar health probe by DAPR_HEALTH_TIMEOUT

DaprHealth.wait_for_sidecar() called urllib.request.urlopen with no
timeout. DAPR_HEALTH_TIMEOUT only limited the retry loop, so a sidecar (or
any process on that port) that accepted the connection but never replied
blocked the call, and every client constructor that waits for the
sidecar, forever.

Each probe now gets a timeout equal to what is left of
DAPR_HEALTH_TIMEOUT, with a 0.5 s floor so the last probe can still get a
reply. The async health check had the same shape, bounded only by
aiohttp's 300 s default, and now uses the same per-probe timeout. Retry,
logging and the final TimeoutError are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Casper Nielsen <casper@diagrid.io>

* fix(health): log async probe timeouts clearly and note sync timeout scope

aiohttp's timeout error has an empty message, so an async probe timeout
was logged as 'Unexpected error during health check:' with nothing after
it. Catch asyncio.TimeoutError and log 'timed out', like the sync client.

Also note in the sync client that urllib's timeout applies per socket
operation, not to the whole request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Casper Nielsen <casper@diagrid.io>

* fix(health): log sync read timeouts as timed out, not unexpected

urllib wraps only connect/send errors in URLError, so a read timeout in
getresponse() reached the generic branch. Also measure the health budget
with time.monotonic() in both clients so a clock jump cannot stretch it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Casper Nielsen <casper@diagrid.io>

* refactor(tests): move listen_without_replying into a shared fake_servers module

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Casper Nielsen <casper@diagrid.io>

---------

Signed-off-by: Casper Nielsen <casper@diagrid.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b14b283)
Signed-off-by: dapr-bot <dapr-bot@users.noreply.github.com>
@dapr-bot
dapr-bot requested review from a team as code owners October 13, 2026 13:04
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-1.19@aadba6b). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff               @@
##             release-1.19    #1270   +/-   ##
===============================================
  Coverage                ?   86.66%           
===============================================
  Files                   ?      163           
  Lines                   ?    12919           
  Branches                ?        0           
===============================================
  Hits                    ?    11196           
  Misses                  ?     1723           
  Partials                ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CasperGN CasperGN assigned CasperGN and unassigned CasperGN Oct 13, 2026
@sicoyle sicoyle added automerge allows dapr bot to merge a PR after tests pass autoupdate labels Oct 15, 2026
@dapr-bot
dapr-bot enabled auto-merge (squash) October 15, 2026 14:05
@CasperGN CasperGN self-assigned this Oct 15, 2026
@dapr-bot
dapr-bot merged commit 2a5eeeb into release-1.19 Oct 15, 2026
22 checks passed
@dapr-bot
dapr-bot deleted the backport-1241-to-release-1.19 branch October 15, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge allows dapr bot to merge a PR after tests pass autoupdate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants