Uh oh!
There was an error while loading. Please reload this page.
fix(redis): tighten stale TCP connection detection and add fast lease deadline - #3311
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
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 |
Uh oh!
There was an error while loading. Please reload this page.
Additional Comments (1)
|
waleedlatif1
commented
Feb 23, 2026
waleedlatif1
commented
Feb 23, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Feb 23, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
… deadline (simstudioai#3311) * fix(redis): tighten stale TCP connection detection and add fast lease deadline * revert(redis): restore original retryStrategy logging * fix(redis): clear deadline timer after Promise.race to prevent memory leak * fix(redis): downgrade lease fallback log to warn — unavailable is expected fallback
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