Skip to content

Commit 42c8f1a

Browse files
Fix JRuby thread interrupt handling in pipelined get
Clear response buffer at start of pipelined_get to remove stale data from interrupted operations. Uses clear() instead of reset() to maintain proper pipeline state detection (pipeline_complete? remains true until pipeline_response_setup is called). This fixes intermittent test failures on JRuby where Thread#raise or Thread#kill during get_multi could leave corrupted buffer data that affected subsequent operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3ef4394 commit 42c8f1a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/dalli/protocol/base.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ def connect
222222
end
223223

224224
def pipelined_get(keys)
225+
# Clear buffer to remove any stale data from interrupted operations.
226+
# Use clear (not reset) to keep pipeline_complete? = true, which is
227+
# the expected state before pipeline_response_setup is called.
228+
response_buffer.clear
229+
225230
req = +''
226231
keys.each do |key|
227232
req << quiet_get_request(key)

0 commit comments

Comments
 (0)