Repository navigation
fix(pipe): avoid nil cache panic with disabled static-TTL multi-cache - #1024
Merged
Merged
Conversation
kurochan
force-pushed
the
fix-nil-cache-panic
branch
from
August 18, 2026 04:43
235762d to
1f77177
Compare
rueian
reviewed
Aug 18, 2026
| for i, ct := range multi { | ||
| commands[i] = Completed(ct.Cmd) | ||
| cmd := ct.Cmd | ||
| cmds.ClearStaticTTL(&cmd) |
Collaborator
There was a problem hiding this comment.
Do we need to ClearStaticTTL at DoCache as well?
rueian
approved these changes
Aug 18, 2026
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
Fix a nil pointer panic when
DoMultiCacheis used with multipleToStaticTTL()commands while client-side caching is disabled.Root cause
With
DisableCache: true, the pipe does not initializep.cache.The
DoMultiCachefallback convertedCacheablecommands toCompletedcommands but preserved the internal static-TTL flag. In the background read
loop, the second and subsequent replies then entered the static-TTL path and
called
p.cache.Updateorp.cache.Cancel, causing a nil pointer panic.Changes
DoMulti.static-TTL commands and a cancelable context.
Compatibility
DisableCacheremains equivalent toDo/DoMulti.Note
Low Risk
Narrow fix for DisableCache + static-TTL edge case; enabled client-side caching paths are unchanged aside from the same clear-on-fallback in DoCache.
Overview
Fixes a nil pointer panic when client-side caching is off (
DisableCache: true) but callers still useDoCache/DoMultiCachewithToStaticTTL()commands.With no cache store, those APIs already fall back to plain
Do/DoMulti, but the static-TTL flag stayed on the wire commands. The background read loop then treated later replies as cacheable and calledp.cache.Update/Cancelon a nil store—especially on the second+ command in aDoMultiCachebatch.Change: strip static-TTL metadata via
cmds.ClearStaticTTLbefore forwarding in both disabled-cache paths so behavior matches untaggedDo/DoMulti. Regression tests cover multi-command success, mixed Redis errors, and singleDoCache.Reviewed by Cursor Bugbot for commit 4245f7a. Bugbot is set up for automated code reviews on this repo. Configure here.