Repository navigation
test(DataHandler): cover deeply nested reply causing decoder stack overflow - #2138
Conversation
|
@GiHoon1123 thank you for this PR, I'll take a look, however please check #2127 as it might make sense to adapt the change for that PR. |
|
Thanks for the pointer! I took a look at #2127 — its Since #2127 is still in progress, this PR still seemed worth having as a fix for the currently released behavior - |
…er stack overflow The RESP3 rewrite (#2127) replaced redis-parser with a new Decoder, and as part of that already wraps decoder.write() in try/catch, routing failures through returnFatalError -> recoverFromFatalError the same way other parser-detected fatal errors are handled. The new Decoder still recurses once per level of RESP aggregate nesting with no depth limit (confirmed directly against lib/resp/decoder.ts), so a sufficiently deeply nested reply still throws a RangeError - it's just already caught and routed through the existing recovery path instead of crashing the process. There was no test pinning this down, so this adds one. Fixes #2108
ac38e15 to
831b5d8
Compare
|
🎉 This PR is included in version 6.1.0-beta.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 6.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Fixes #2108.
redis-parser(and its replacement, the RESP3 Decoder from #2127) recursesonce per level of RESP aggregate nesting with no depth limit, so a
sufficiently deeply nested reply throws a RangeError instead of reporting a
parser error.
#2127 already wraps the decoder call in try/catch and routes failures
through the existing returnFatalError -> recoverFromFatalError path, so
this no longer needs a code change. There was no test pinning that behavior
down for this specific case, so this adds one.
Verified by temporarily removing the try/catch and confirming the new test
fails with the expected RangeError.
Note
Low Risk
The change is narrowly scoped defensive error handling around inbound parsing; the diff here is test-only, with production behavior already aligned to the existing fatal-recovery path.
Overview
This PR’s visible diff adds a regression test in
DataHandlerfor issue #2108: feeding a reply nested ~50,000*1arrays must not throw synchronously and must invokerecoverFromFatalErroronce with aRangeError(“Maximum call stack size exceeded”) and{ offlineQueue: false }.The accompanying fix (described in the PR, not in the snippet above) wraps stream
decoder.writeintry/catchand forwards unexpected errors through the existingreturnFatalError→recoverFromFatalErrorpath so parser stack overflows recover instead of killing the Node process.Reviewed by Cursor Bugbot for commit 831b5d8. Bugbot is set up for automated code reviews on this repo. Configure here.