Bug fix: reset io_last_written on c->buf resize to prevent stale pointers#2786
Merged
hpatro merged 1 commit intovalkey-io:unstablefrom Oct 30, 2025
Merged
Bug fix: reset io_last_written on c->buf resize to prevent stale pointers#2786hpatro merged 1 commit intovalkey-io:unstablefrom
hpatro merged 1 commit intovalkey-io:unstablefrom
Conversation
…ters
Fixes an assert crash in _writeToClient():
serverAssert(c->io_last_written.data_len == 0 ||
c->io_last_written.buf == c->buf);
The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates
c->buf while io_last_written still points to the old buffer and data_len is
non-zero. On the next write, both conditions in the assertion become false.
Reset io_last_written when resizing the output buffer to prevent stale pointers
and keep state consistent.
fixes valkey-io#2769
Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #2786 +/- ##
============================================
- Coverage 72.42% 72.26% -0.16%
============================================
Files 128 128
Lines 70209 70211 +2
============================================
- Hits 50847 50740 -107
- Misses 19362 19471 +109
🚀 New features to boost your workflow:
|
hpatro
approved these changes
Oct 30, 2025
hpatro
reviewed
Oct 30, 2025
zhijun42
pushed a commit
to zhijun42/valkey
that referenced
this pull request
Nov 15, 2025
…ters (valkey-io#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes valkey-io#2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zhijun42
pushed a commit
to zhijun42/valkey
that referenced
this pull request
Nov 15, 2025
…ters (valkey-io#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes valkey-io#2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zhijun42
pushed a commit
to zhijun42/valkey
that referenced
this pull request
Nov 28, 2025
…ters (valkey-io#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes valkey-io#2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zhijun42
pushed a commit
to zhijun42/valkey
that referenced
this pull request
Nov 28, 2025
…ters (valkey-io#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes valkey-io#2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zhijun42
pushed a commit
to zhijun42/valkey
that referenced
this pull request
Nov 28, 2025
…ters (valkey-io#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes valkey-io#2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zuiderkwast
pushed a commit
to zuiderkwast/placeholderkv
that referenced
this pull request
Dec 4, 2025
…ters (valkey-io#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes valkey-io#2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
zuiderkwast
pushed a commit
that referenced
this pull request
Dec 9, 2025
…ters (#2786) Fixes an assert crash in _writeToClient(): serverAssert(c->io_last_written.data_len == 0 || c->io_last_written.buf == c->buf); The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false. Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent. fixes #2769 Signed-off-by: xbasel <103044017+xbasel@users.noreply.github.com>
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.
Fixes an assert crash in _writeToClient():
The issue occurs when clientsCronResizeOutputBuffer() grows or reallocates c->buf while io_last_written still points to the old buffer and data_len is non-zero. On the next write, both conditions in the assertion become false.
Reset io_last_written when resizing the output buffer to prevent stale pointers and keep state consistent.
fixes #2769