Skip to content

test(examples): retry background sidecar on transient port-bind flake#1101

Open
kshitizj03 wants to merge 1 commit into
dapr:mainfrom
kshitizj03:fix/1061-demo-actor-port-bind-retry
Open

test(examples): retry background sidecar on transient port-bind flake#1101
kshitizj03 wants to merge 1 commit into
dapr:mainfrom
kshitizj03:fix/1061-demo-actor-port-bind-retry

Conversation

@kshitizj03

Copy link
Copy Markdown

Description

test_demo_actor flakes when the demo-actor sidecar, started via DaprRunner.start(), loses a random-port race at boot: daprd assigns the same port to its API and internal gRPC servers, the internal listener fails with "bind: address already in use", and the runtime exits with "could not listen on any endpoint". The actor host is then dead, so the client's invoke_method fails with "did not find address for actor" and the expected output never appears.

PR #1030 already added this retry to the foreground run() path, but the background start() path was left uncovered. This applies the same exponential backoff retry there, reusing the existing failure markers. The captured log is only read once the process has exited (poll() is not None), so a healthy long-lived sidecar is never inspected and its append offset is left untouched.

Adds unit tests mirroring the existing run() coverage.

Fixes #1061

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

`test_demo_actor` flakes when the demo-actor sidecar, started via
`DaprRunner.start()`, loses a random-port race at boot: daprd assigns the
same port to its API and internal gRPC servers, the internal listener fails
with "bind: address already in use", and the runtime exits with
"could not listen on any endpoint". The actor host is then dead, so the
client's `invoke_method` fails with "did not find address for actor" and the
expected output never appears.

PR dapr#1030 already added this retry to the foreground `run()` path, but the
background `start()` path was left uncovered. Apply the same exponential
backoff retry there, reusing the existing failure markers. The captured log
is only read once the process has exited (`poll()` is not None), so a healthy
long-lived sidecar is never inspected and its append offset is left untouched.

Adds unit tests mirroring the existing `run()` coverage.

Fixes dapr#1061

Signed-off-by: Kshitiz Jain <kshitizj@gmail.com>
@kshitizj03 kshitizj03 requested review from a team as code owners June 20, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: test_demo_actor flake

1 participant