Skip to content

Remove the default dispatch stream deadline - #355

Merged
Marenz merged 1 commit into
frequenz-floss:v1.x.xfrom
Marenz:fix/no-default-stream-deadline
Nov 13, 2026
Merged

Marenz merged 1 commit into
frequenz-floss:v1.x.xfrom
Marenz:fix/no-default-stream-deadline

Conversation

@Marenz

@Marenz Marenz commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Dispatch streams currently reconnect every five minutes even while healthy because the client applies a default deadline.

Default stream_timeout to None so gRPC keepalive detects dead connections. Callers can still pass a finite timeout; unary deadlines are unchanged.

Healthy dispatch streams should not reconnect on a timer. Let gRPC keepalive
detect dead connections unless the caller requests a finite stream timeout.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@Marenz
Marenz requested review from a team as code owners November 11, 2026 09:47
@Marenz
Marenz requested review from ela-kotulska-frequenz and florian-wagner-frequenz and removed request for a team November 11, 2026 09:47
@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:dispatcher labels Nov 11, 2026
@Marenz
Marenz enabled auto-merge November 11, 2026 09:49
@llucax

llucax commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

So, we originally added this because the keep alive didn't always break a dead connection, right? I remember there was a Bugfix related to keep alive, so maybe that was the reason and it now should work?

Did you try to test this in scenarios where keep alive should kick in to verify we can really recover from a stalled TCP connection?

@Marenz

Marenz commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Yes, that was the reason. It was fixed on both sides:

  • Client: client-base passed the keep-alive options as floats, gRPC ignored them, and no pings were sent at all. Fixed in Fix HTTP/2 keep-alive channel options frequenz-client-base-python#268 (v0.11.3); this PR requires >= 0.11.3.
  • Server: Dispatch now pings every 60 s (was 1800 s) with a 20 s timeout, and Caddy's backend read_timeout (5 min) is set above that, so idle streams are no longer cut by the proxy.

Tested from a controller with a cellular uplink, against staging:

  • 7 days, same stream with the 5 min deadline vs. without. With deadline: 2008 reconnects. Without: 3 reconnects.

  • Packet drops in the client's network namespace, no deadline:

    • ~30 s two-way: connection survives.
    • ~100 s two-way: UNAVAILABLE after ~90 s.
    • ~100 s client→server only: UNAVAILABLE after ~23 s.
    • ~100 s server→client only: UNAVAILABLE after ~91 s.

    In every case the stream reconnected and received a fresh update 3–8 s after the drop ended.

@llucax llucax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! 🎉

@Marenz
Marenz added this pull request to the merge queue Nov 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 13, 2026
@Marenz
Marenz merged commit dfb0005 into frequenz-floss:v1.x.x Nov 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:dispatcher part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants