Skip to content

spelling: ; otherwise, - #2238

Merged
rainsupreme merged 1 commit into
valkey-io:unstablefrom
jsoref:spelling-1
Oct 21, 2026
Merged

rainsupreme merged 1 commit into
valkey-io:unstablefrom
jsoref:spelling-1

Conversation

@jsoref

@jsoref jsoref commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

@rainsupreme rainsupreme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment fixes are good, but could you drop the changes to user-facing error/diagnostic strings? Specifically:

  • src/networking.c (HELLO error reply)
  • src/server.c (processCommand reject message)
  • src/object.c (MEMORY DOCTOR output)

These are protocol/CLI-observable strings that clients may match on. The rest is clean to merge, once this is rebased :)

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e34bbc59-1e72-4983-88a1-591728a7f2e6
📥 Commits

Reviewing files that changed from the base of the PR and between 6feed8d and fa4d2df.

📒 Files selected for processing: 31
  • src/acl.c
  • src/bitops.c
  • src/cluster.c
  • src/cluster_legacy.c
  • src/config.c
  • src/config.h
  • src/db.c
  • src/expire.c
  • src/hyperloglog.c
  • src/listpack.c
  • src/module.c
  • src/networking.c
  • src/object.c
  • src/rax.c
  • src/rax.h
  • src/rdb.c
  • src/replication.c
  • src/server.c
  • src/server.h
  • src/t_hash.c
  • src/t_set.c
  • src/t_stream.c
  • src/t_zset.c
  • src/tracking.c
  • src/unit/test_rax.cpp
  • src/util.c
  • src/valkey-check-rdb.c
  • src/valkey-cli.c
  • tests/support/server.tcl
  • tests/unit/other.tcl
  • valkey.conf
🚧 Files skipped from review as they are similar to previous changes: 31
  • tests/unit/other.tcl
  • src/config.h
  • tests/support/server.tcl
  • src/server.h
  • src/t_zset.c
  • src/object.c
  • src/util.c
  • src/rax.h
  • src/unit/test_rax.cpp
  • src/valkey-check-rdb.c
  • src/config.c
  • src/t_set.c
  • src/expire.c
  • src/listpack.c
  • src/cluster.c
  • src/t_hash.c
  • src/rdb.c
  • src/bitops.c
  • src/tracking.c
  • valkey.conf
  • src/valkey-cli.c
  • src/db.c
  • src/server.c
  • src/cluster_legacy.c
  • src/networking.c
  • src/hyperloglog.c
  • src/t_stream.c
  • src/acl.c
  • src/rax.c
  • src/replication.c
  • src/module.c

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The pull request corrects punctuation, grammar, and wording in comments and documentation across source files, tests, and valkey.conf. No executable behavior, declarations, configuration values, or test logic changed.

Changes: Documentation-only corrections

Layer / File(s) Summary
Documentation corrections
src/*, tests/*, valkey.conf
Corrected comment punctuation, grammar, return-value descriptions, and explanatory wording across the source tree, tests, tools, and configuration comments.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • valkey-io/valkey#2248: Both pull requests make overlapping comment-only punctuation and wording corrections.

Suggested reviewers: rainsupreme

Merge Risk: ⚪ Minimal · up to fa4d2

No actionable merge-blocking issue is identified in these wording changes; merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title identifies a real punctuation change in the comments. It is narrow but remains related to the changeset.
Description check Passed The description identifies this pull request as a subset of PR #2183, which matches the stated objective and changeset context.
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 120 functions across 37 files. (4 skipped: …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 120 functions across 37 files. (4 skipped: 3 unsupported, 1 too large.)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/acl.c`:
- Line 1845: Add the missing commas in the conditional documentation sentences
in src/acl.c: insert a comma after “command” near the ACL_OK description and
after “match” in the corresponding sentence near line 2951, without changing the
documented behavior or surrounding wording.

In `@src/config.h`:
- Line 203: Update the comment above the rdb_fsync_range platform branches to
document the macOS-specific __APPLE__ path using fcntl(..., F_FULLFSYNC), while
distinguishing it from the plain fsync() fallback on other non-Linux platforms.

In `@src/geo.c`:
- Line 107: Update the return-status documentation comment near the geo parsing
function to explicitly state that C_OK is returned on success, matching the
“C_ERR is returned” wording and punctuation used for parse errors.

In `@src/module.c`:
- Line 2732: Update the comment near the AUTO_MEMORY flag handling to remove the
comma before “will,” keeping the sentence grammatically correct without changing
the surrounding implementation.

In `@src/networking.c`:
- Line 1116: Update the trimming comment near the allocation guidance so the
sentence reads “trim the space if it is relatively high,” adding the missing
“if” without changing the surrounding explanation.

In `@src/object.c`:
- Line 1611: Update the MEMORY DOCTOR message string in the relevant diagnostic
text to replace “shutdown and restart” with “shut down and restart,” preserving
the rest of the wording unchanged.

In `@src/replication.c`:
- Around line 2263-2268: Update the two comments in the diskless-load safety
checks to say “Check that all modules handle...” for both read errors and async
replication, without changing the surrounding logic.

In `@src/sentinel.c`:
- Line 4635: Update the documentation sentence near the Sentinel vote-return
description to add a comma after “available” and use the imperative “return
NULL” wording.

In `@src/server.c`:
- Line 4656: Update the nearby comment in server.c to replace “transactions
commands” with “transaction commands,” leaving the surrounding wording and
implementation unchanged.

In `@src/t_stream.c`:
- Line 3139: Update the documentation comment near the stream message
requirement to replace “the message must be exist” with “the message must
exist,” correcting the grammar without changing the surrounding meaning.
- Line 2533: Update the documentation comment near the stream creation API so
the phrase “the same name already exists NULL is returned” includes a comma
after “exists,” without changing the surrounding wording or implementation.

In `@src/t_zset.c`:
- Line 3919: Update the comment immediately before the candidate-selection loop
in t_zset.c to state that checkType returns on type errors, while the loop
breaks after finding the first existing key with a valid type and identifies it
as the candidate.

In `@src/tracking.c`:
- Line 115: Update the comment for checkPrefixCollisionsOrReply to state that it
returns 0 when a collision is found and 1 otherwise, correcting the grammar from
“1 is return.”

In `@valkey.conf`:
- Line 638: Update the comment near the RDB persistence configuration to add the
missing subject after “otherwise,” explicitly stating that the option is
completely ignored while preserving the existing meaning.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc131a72-3ab5-4c03-b075-909f284467e8

📥 Commits

Reviewing files that changed from the base of the PR and between 2dfee30 and 66a3d3d.

📒 Files selected for processing (48)
  • src/acl.c
  • src/bitops.c
  • src/cluster.c
  • src/cluster_legacy.c
  • src/config.c
  • src/config.h
  • src/crccombine.c
  • src/db.c
  • src/expire.c
  • src/geo.c
  • src/hyperloglog.c
  • src/kvstore.c
  • src/listpack.c
  • src/module.c
  • src/modules/hellodict.c
  • src/networking.c
  • src/object.c
  • src/quicklist.c
  • src/quicklist.h
  • src/rax.c
  • src/rax.h
  • src/rdb.c
  • src/replication.c
  • src/sentinel.c
  • src/server.c
  • src/server.h
  • src/siphash.c
  • src/syncio.c
  • src/t_hash.c
  • src/t_list.c
  • src/t_set.c
  • src/t_stream.c
  • src/t_zset.c
  • src/tracking.c
  • src/unit/test_rax.cpp
  • src/util.c
  • src/valkey-check-rdb.c
  • src/valkey-cli.c
  • src/ziplist.c
  • tests/integration/replication-psync.tcl
  • tests/modules/basics.c
  • tests/modules/list.c
  • tests/support/server.tcl
  • tests/test_helper.tcl
  • tests/unit/cluster/cluster-multiple-meets.tcl
  • tests/unit/maxmemory.tcl
  • tests/unit/other.tcl
  • valkey.conf

Comment thread src/acl.c
* ACLs associated with the specified selector.
*
* If the selector can execute the command ACL_OK is returned, otherwise
* If the selector can execute the command ACL_OK is returned; otherwise,

@coderabbitai coderabbitai Bot Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the missing commas in the conditional sentences.

  • Line 1845 needs a comma after command.
  • Line 2951 needs a comma after match.

These commas separate each condition from the returned value or action.

Proposed wording fix
- * If the selector can execute the command ACL_OK is returned; otherwise,
+ * If the selector can execute the command, ACL_OK is returned; otherwise,

-    /* If there is a match update the entry; otherwise, add it as a
+    /* If there is a match, update the entry; otherwise, add it as a

Also applies to: 2951-2951

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/acl.c` at line 1845, Add the missing commas in the conditional
documentation sentences in src/acl.c: insert a comma after “command” near the
ACL_OK description and after “match” in the corresponding sentence near line
2951, without changing the documented behavior or surrounding wording.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside of scope

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoref, acknowledged. This punctuation-only change is outside the scope of this PR.

Do you want me to open a follow-up GitHub issue for src/acl.c?

You are interacting with an AI system.

Comment thread src/config.h Resolved
Comment thread src/geo.c Resolved
Comment thread src/module.c Resolved
Comment thread src/networking.c

/* We only try to trim the space is relatively high (more than a 1/4 of the
* allocation), otherwise there's a high chance realloc will NOP.
* allocation); otherwise, there's a high chance realloc will NOP.

@coderabbitai coderabbitai Bot Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Complete the condition in the trimming comment.

The sentence currently reads “trim the space is relatively high”. Add if so the condition is clear.

Proposed wording
-    /* We only try to trim the space is relatively high (more than a 1/4 of the
-     * allocation); otherwise, there's a high chance realloc will NOP.
+    /* We only try to trim the space if it is relatively high (more than a 1/4
+     * of the allocation); otherwise, there's a high chance realloc will NOP.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* allocation); otherwise, there's a high chance realloc will NOP.
/* We only try to trim the space if it is relatively high (more than a 1/4
* of the allocation); otherwise, there's a high chance realloc will NOP.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/networking.c` at line 1116, Update the trimming comment near the
allocation guidance so the sentence reads “trim the space if it is relatively
high,” adding the missing “if” without changing the surrounding explanation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside of scope

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoref Acknowledged. This wording correction is outside the scope of this PR.

Do you want me to open a follow-up GitHub issue for it?

You are interacting with an AI system.

Comment thread src/t_stream.c
/* Create a new consumer group in the context of the stream 's', having the
* specified name, last server ID and reads counter. If a consumer group with
* the same name already exists NULL is returned, otherwise the pointer to the
* the same name already exists NULL is returned; otherwise, the pointer to the

@coderabbitai coderabbitai Bot Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the missing comma after exists.

The comment reads the same name already exists NULL is returned. Add a comma before NULL.

Proposed fix
- * the same name already exists NULL is returned; otherwise, the pointer to the
+ * the same name already exists, NULL is returned; otherwise, the pointer to the
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* the same name already exists NULL is returned; otherwise, the pointer to the
* the same name already exists, NULL is returned; otherwise, the pointer to the
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/t_stream.c` at line 2533, Update the documentation comment near the
stream creation API so the phrase “the same name already exists NULL is
returned” includes a comma after “exists,” without changing the surrounding
wording or implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside of scope

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoref, acknowledged. This punctuation change is outside the scope of this PR. Would you like me to open a follow-up GitHub issue?

You are interacting with an AI system.

Comment thread src/t_stream.c Resolved
Comment thread src/t_zset.c Resolved
Comment thread src/tracking.c
* with an existing prefix for the client. A collision is defined as two
* prefixes that will emit an invalidation for the same key. If no prefix
* collision is found, 1 is return, otherwise 0 is returned and the client
* collision is found, 1 is return; otherwise, 0 is returned and the client

@coderabbitai coderabbitai Bot Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the documented return values.

checkPrefixCollisionsOrReply returns 0 when a collision is found and 1 otherwise. The current comment states the reverse. It also says 1 is return.

Proposed fix
- * collision is found, 1 is return; otherwise, 0 is returned and the client
+ * collision is found, 0 is returned; otherwise, 1 is returned and the client
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* collision is found, 1 is return; otherwise, 0 is returned and the client
* collision is found, 0 is returned; otherwise, 1 is returned and the client
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tracking.c` at line 115, Update the comment for
checkPrefixCollisionsOrReply to state that it returns 0 when a collision is
found and 1 otherwise, correcting the grammar from “1 is return.”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside of scope

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoref, acknowledged. This correction is outside the scope of this PR.

Would you like me to open a follow-up issue for the checkPrefixCollisionsOrReply comment in src/tracking.c?

You are interacting with an AI system.

Comment thread valkey.conf
# in order to load them for the initial synchronization, should be deleted
# ASAP. Note that this option ONLY WORKS in instances that have both AOF
# and RDB persistence disabled, otherwise is completely ignored.
# and RDB persistence disabled; otherwise, is completely ignored.

@coderabbitai coderabbitai Bot Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the missing subject after otherwise.

The phrase otherwise, is completely ignored is grammatically incomplete. State that the option is ignored.

Proposed wording
-# and RDB persistence disabled; otherwise, is completely ignored.
+# and RDB persistence disabled; otherwise, it is completely ignored.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# and RDB persistence disabled; otherwise, is completely ignored.
# and RDB persistence disabled; otherwise, it is completely ignored.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@valkey.conf` at line 638, Update the comment near the RDB persistence
configuration to add the missing subject after “otherwise,” explicitly stating
that the option is completely ignored while preserving the existing meaning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside of scope

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoref, acknowledged. This correction is outside the scope of #2238.

Would you like me to open a follow-up issue for the valkey.conf grammar correction?

You are interacting with an AI system.

@jsoref jsoref left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coderabbitai's notes are outside of scope

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.83%. Comparing base (b936001) to head (fa4d2df).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #2238      +/-   ##
============================================
- Coverage     80.93%   80.83%   -0.11%     
============================================
  Files           196      196              
  Lines        102634   102634              
============================================
- Hits          83068    82962     -106     
- Misses        19566    19672     +106     
Files with missing lines Coverage Δ
src/acl.c 92.55% <ø> (ø)
src/bitops.c 96.22% <ø> (ø)
src/cluster.c 92.56% <ø> (ø)
src/cluster_legacy.c 89.21% <ø> (+0.25%) ⬆️
src/config.c 81.04% <ø> (ø)
src/crccombine.c 100.00% <ø> (ø)
src/db.c 95.52% <ø> (ø)
src/expire.c 98.13% <ø> (+0.79%) ⬆️
src/geo.c 93.95% <ø> (ø)
src/hyperloglog.c 92.66% <ø> (ø)
... and 25 more

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sarthakaggarwal97 sarthakaggarwal97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoref just to be safe, would you please drop the externally observable strings in networking.c, object.c, and server. c.

Seems simple enough to merge it after this

@rainsupreme

rainsupreme commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@jsoref LGTM - looks like all feedback has been addressed. Could you rebase and resolve merge conflicts so I can merge it? (You can @ ping me here and I'll get it merged promptly this time I promise! 😅)

Signed-off-by: Josh Soref <[email protected]>
@valkey-review-bot

Copy link
Copy Markdown
Contributor

Review state

Ready for human review.
Only comments and valkey.conf documentation change in this diff, in one signed-off commit. The HELLO, processCommand reject and MEMORY DOCTOR string edits that maintainers asked to drop are no longer present. In networking.c, server.c and object.c only comments change.

Risk: Low. No code, reply string or log string changes, so behavior cannot change. A wrong edit could only make a comment read badly.

Open findings: none.

Backport: Not needed. Comment and documentation punctuation cleanup only. It fixes no bug.

Updated for fa4d2df at 2026-10-21 12:22 UTC. The bot rewrites this comment on every review.

@rainsupreme rainsupreme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rainsupreme
rainsupreme merged commit 4a69869 into valkey-io:unstable Oct 21, 2026
65 checks passed
@jsoref
jsoref deleted the spelling-1 branch October 21, 2026 15:07
@JimB123 JimB123 moved this from Todo to To be backported in Valkey 9.2 Oct 21, 2026
valkeyrie-ops Bot pushed a commit that referenced this pull request Oct 22, 2026
- Subset of #2183

Signed-off-by: Josh Soref <[email protected]>
Backport-Source-PR: 2238
JimB123 pushed a commit that referenced this pull request Oct 23, 2026
- Subset of #2183

Signed-off-by: Josh Soref <[email protected]>
Backport-Source-PR: 2238
@valkeyrie-ops valkeyrie-ops Bot moved this from To be backported to Done in Valkey 9.2 Oct 23, 2026
sarthakaggarwal97 pushed a commit that referenced this pull request Dec 1, 2026
`Module rdbloadsave with bgsave` failed in `test-valgrind-misc` on `7.2`
([run](https://github.com/valkey-io/valkey/actions/runs/43841035188)).
No change on `unstable` fixes it. The fix made there applies here as it
is: it is made here first, and backported to `7.2` once it merges.

**Root cause:** The valgrind report for server 21281 contains "Process
terminating with default action of signal 10 (SIGUSR1)" for fork child
21319, with a stack of bgsaveCommand, rdbSaveBackground, redisFork,
fork, _Fork. The child was still inside libc's fork() when the signal
arrived. "Module rdbloadsave with bgsave" sends BGSAVE and immediately
calls test.rdbload, whose RM_RdbLoad() calls killRDBChild(). redisFork()
installs the child's SIGUSR1 handler only after fork() returns, so under
valgrind the slow child got the signal with the default action. Valgrind
prints a stack trace for that, and the harness treats any " at 0x" in
the server's stderr as an error. The server itself handled it correctly,
since checkChildrenDone() accepts a child terminated by SIGUSR1. The
failure is flaky.

**The fix:** The server promises nothing about a child killed in the
first instants after fork, and the parent treats a SIGUSR1 death as a
clean kill, so this is a test race and not a product defect. The child
creates temp-<pid>.rdb at the start of rdbSave(), after
setupChildSignalHandlers(), so waiting for that file is a wait for the
exact state the kill depends on, not for a length of time. It uses the
existing get_child_pid helper and the same temp file check
tests/unit/shutdown.tcl already uses. The test still checks that
RM_RdbLoad() kills the child and that the loaded value is read back, and
the harness check is untouched. The single key's 500 ms save delay
leaves a wide window after the file appears, with a 10 ms poll.

**What the bot checked**

- The fix applies to `unstable` at `180283c3f217`, and was run there
too.
- With the fix, this command passed 4 loops:

  ```sh
make -j"$(getconf _NPROCESSORS_ONLN)" valgrind all-with-unit-tests
SERVER_CFLAGS='-Werror' BUILD_ZSTD=yes USE_LIBBACKTRACE=yes &&
CFLAGS='-Werror' ./runtest-moduleapi --valgrind --no-latency --verbose
--clients 1 --timeout 2400 --dump-logs --single
unit/moduleapi/rdbloadsave --only 'Module rdbloadsave with bgsave'
--fastfail --loops 4 --timeout 2400
  ```

<details><summary>The agent's own notes</summary>

Nothing was built or run here. The log's [err] line names no test
because the harness reads the valgrind report when the server is stopped
at the end of the file. I attribute it to "Module rdbloadsave with
bgsave" because the stack goes through bgsaveCommand and that test
issues the only BGSAVE on that server. The patch also adds the same wait
to "Module rdbloadsave with aof", which calls BGREWRITEAOF and then
test.rdbload with no round trip in between, so stopAppendOnly() kills
the AOF child the same way. The log does not show that site failing (AOF
child 21316 exited through its handler in this run), so a maintainer who
wants the strictly minimal change can drop that hunk. A third, much
narrower window remains unchanged: the AOF child that RM_RdbLoad()
restarts is killed by the later "config set appendonly no", several
round trips after its fork. No upstream commit fixes this. The listed
port candidates (Forkless Save, Forkless Full-Sync, streaming
compression, spelling) are unrelated features, and ce51207 (_exit
in the SIGUSR1 handler) is already on this branch and does not close the
window before the handler is installed. The other release branches' bot
PRs carry only that same _exit port, so none of them fits. The default
branch does not have this fix. I could not read its copy of the test,
but none of the listed upstream commits to rdbloadsave.tcl or server.c
addresses the race, so it most likely needs the same test change
wherever BGSAVE still forks.

</details>

<details><summary>What the bot checked on <code>7.2</code></summary>

- Existing fixes found: `6454bcc62855` Forkless Full-Sync (#4797) (port
candidate); `4a698691cf57` spelling: ; otherwise, (#2238) (port
candidate); `66f9618f4309` Streaming Compression support for Replication
(#3853) (port candidate); `acba5ddd0691` Forkless Save (#4460) (port
candidate); `cc45d0637a00` Fix various typos around otherwise with a
comma (port candidate)
- Code could not tell from the log which test failed, so it ran the one
the author named: `Module rdbloadsave with bgsave` in
`tests/unit/moduleapi/rdbloadsave.tcl`. Check against the log that it is
the test that failed.
- No change on the default branch was found to fix this failure, so this
fix was written for this branch: the default branch does not have it.
- With the fix, this command passed 3 loops:

  ```sh
make -j"$(getconf _NPROCESSORS_ONLN)" valgrind SERVER_CFLAGS='-Werror
-DREDIS_TEST' && CFLAGS='-Werror' ./runtest-moduleapi --valgrind
--no-latency --verbose --clients 1 --timeout 2400 --dump-logs --single
unit/moduleapi/rdbloadsave.ci-fix-isolated --loops 3 --timeout 2400
  ```
- One loop takes 695s, so 3 loops ran, not 4.
- Review: The log supports the diagnosis: the valgrind report for server
21281 shows fork child 21319 terminated by the default action of SIGUSR1
while still inside fork() under redisFork, rdbSaveBackground and
bgsaveCommand, and only "Module rdbloadsave with bgsave" issues BGSAVE
on that server. The code agrees: redisFork() installs the child's
SIGUSR1 handler only after fork() returns, VM_RdbLoad() calls
killRDBChild() at once, and the parent treats a SIGUSR1 death as a clean
kill, so this is a test race and not a product defect. The fix polls for
temp-<pid>.rdb, which rdbSave() opens after the handler is installed and
before the 500 ms per-key delay, so it waits for the state the kill
depends on. It uses the existing get_child_pid and wait_for_condition
helpers with a failure message, and leaves the harness check and the
test's assertions untouched. The AOF hunk is not shown failing in this
log, as the author states, but it closes the identical one-round-trip
window (stopAppendOnly sends SIGUSR1 right after BGREWRITEAOF) that
feeds the same per-server valgrind report. Its file name matches what
rewriteAppendOnlyFile() creates in the server dir, so I accept it as the
same root cause and not scope creep. The author reports three valgrind
loops passing with the fix; I did not run anything myself.

</details>

---

<sub>Prepared by the CI-fix bot, which never merges. This PR's CI and a
maintainer's review decide. Its commit has no DCO sign-off: whoever
takes the change over signs it off.</sub>

Signed-off-by: Sarthak Aggarwal <[email protected]>
Co-authored-by: valkeyrie-ops[bot] <284117741+valkeyrie-ops[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants