fix(operator): drop wall-clock query timeout, keep TCP keepalives#56
Merged
Conversation
The per-query 5-minute timeout introduced alongside TCP keepalives in 0.3.19 turned out to be too tight for a legitimately slow operation: DROP SCHEMA dbt CASCADE on a populated dbt schema can run for tens of minutes. With the timeout in place, every retry hits the same wall and the reconcile loop never converges, which is worse than the original wedge it was meant to mitigate. TCP keepalives alone are sufficient to detect the failure mode we saw (NAT-evicted / silently-dead sockets): the kernel sends probes on its own timer regardless of whether a query is in flight, so a dead socket errors out within ~90s while a long-running statement keeps working. Remove the QUERY_TIMEOUT plumbing and revert the four call sites back to direct tokio_postgres methods. Also record the lesson in AGENTS.md so the next iteration doesn't re-add the timeout.
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.
🤖
Summary
Follow-up to #55. The per-query 5-minute `tokio::time::timeout` introduced alongside TCP keepalives turned out to be too tight for a legitimately slow statement: `DROP SCHEMA dbt CASCADE` on a populated dbt schema runs for tens of minutes. With the timeout in place, every retry hits the same wall and the reconcile loop never converges — worse than the original wedge it was meant to mitigate.
Why keepalives alone are enough
The original failure mode was a NAT-evicted (or otherwise silently-dead) socket: the operator's tokio task waits for a server reply that will never come. TCP keepalives fire on the kernel's own timer regardless of in-flight application traffic, so:
So the wall-clock timeout is unnecessary and actively harmful.
Shape