Fix: disable go-redis default 3s read timeout that kills long-running queries#101
Fix: disable go-redis default 3s read timeout that kills long-running queries#101Naseem77 wants to merge 2 commits into
Conversation
go-redis silently applies a 3 second ReadTimeout when the caller leaves it unset (0), so any graph query longer than 3 seconds failed with an i/o timeout - and go-redis then retried the command up to 3 times, re-executing writes - while the server kept running the query. Default ReadTimeout and WriteTimeout to -1 (no client-side deadline) unless explicitly set; query duration is governed by the server TIMEOUT / TIMEOUT_DEFAULT configuration, matching the other FalkorDB clients. Also propagate the timeouts to the sentinel failover client, which previously dropped them.
FalkorDBNewCluster and FromURL inherited the same hidden 3s ReadTimeout; apply the same no-deadline defaults and propagate ReadTimeout/WriteTimeout through the FromURL sentinel failover path for consistency.
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
go-redis v9 silently applies a 3 second ReadTimeout when
Options.ReadTimeoutis left at 0. Any graph query taking longer than 3 seconds (bulk loads, deep traversals) fails with:Worse, go-redis automatically retries the command up to 3 times (observed failure at ~12s = 3s x 4 attempts), re-executing write queries and duplicating data, while the server keeps running the original query.
Same class of bug already fixed in falkordb-rs (FalkorDB/falkordb-rs#297, redis-rs 500ms default) and JFalkorDB (FalkorDB/JFalkorDB#282, Jedis 2000ms default). falkordb-py, falkordb-ts and falkordb-php are unaffected.
Fix
When the caller leaves
ReadTimeout/WriteTimeoutunset, default them to -1 (no client-side deadline) in all entry points:FalkorDBNew,FalkorDBNewCluster,FromURL, plus both sentinel failover paths (which previously dropped the timeouts entirely). Query duration is governed by the server'sTIMEOUT/TIMEOUT_DEFAULTconfiguration, consistent with the other FalkorDB clients. Explicitly-set timeouts are fully respected.Validation
Against FalkorDB v4.20.1,
UNWIND range(1,80000000) AS x RETURN sum(x)(~4-5s):FalkorDBNewFromURLReadTimeout: 2sgo build,go vet,gofmtclean