fix(redis): tighten stale TCP connection detection and add fast lease deadline#3311
Merged
waleedlatif1 merged 4 commits intostagingfrom Feb 23, 2026
Merged
fix(redis): tighten stale TCP connection detection and add fast lease deadline#3311waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR addresses Redis connection reliability issues in ECS deployments where NAT gateway idle timeouts (350s) cause silent TCP connection failures. The fix reduces stale connection detection from ≤90s to ≤30s and adds a 200ms hard deadline on Redis eval operations to prevent request hangs. Key changes:
The implementation correctly prevents the race condition between Redis command timeout (5000ms) and HTTP abort timeout by forcing lease acquisition to fail within 200ms and fall back to local execution. Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 5003c1d |
Contributor
Additional Comments (1)
|
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@cursor review |
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
Root cause
ECS tasks route to Redis Cloud via NAT gateway. AWS NAT has a fixed 350s TCP idle timeout — connections idle longer than that get their NAT entry silently dropped. The next command on the dead socket hung until commandTimeout (5000ms), which raced exactly with the HTTP abort timeout on condition evaluation, killing requests instead of falling back.
Type of Change
Testing
Tested manually — all redis.test.ts and isolated-vm tests pass
Checklist