valkey-benchmark: reject empty command sequence instead of hanging#4215
valkey-benchmark: reject empty command sequence instead of hanging#4215dhruv2x wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe benchmark now rejects executions where a repeat count is not followed by a command, reports an error, and includes an integration test covering the failure. ChangesBenchmark command validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@tests/integration/valkey-benchmark.tcl`:
- Around line 119-123: Update the test “benchmark: repeat count without command
errors out cleanly” to capture Tcl’s catch options via the third argument,
inspect the returned -errorcode, and assert the child process status is
explicitly 1 rather than treating catch’s return value as the exit code.
Preserve the existing error-output assertion.
🪄 Autofix (Beta)
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: f3404fd4-bdc9-49b7-a567-a17c19e15f44
📒 Files selected for processing (2)
src/valkey-benchmark.ctests/integration/valkey-benchmark.tcl
A repeat count with no command (e.g. `valkey-benchmark 10000`) builds
an empty command sequence but still starts the benchmark. With nothing
to send, the event loop spins forever at ~100% CPU printing `-nan`.
Guard against this by checking seq_len before running: if no command
was parsed, print a usage error and exit 1 instead of looping.
For example, before this change:
$ valkey-benchmark -h 127.0.0.1 -p 6379 10000
10000: rps=0.0 (overall: -nan) avg_msec=-nan 0 requests
10000: rps=0.0 (overall: 0.0) avg_msec=-nan 0 requests
^C # hangs forever at ~100% CPU, never exits
After this change:
$ valkey-benchmark -h 127.0.0.1 -p 6379 10000
No command specified: a repeat count must be followed by a command.
Use -n <requests> to set the total number of requests.
$ echo $?
1
Signed-off-by: Dhruv Chauhan <chauhandhruv351@gmail.com>
a05a96f to
ee93139
Compare
|
hello @sarthakaggarwal97 can you have a look? |
A repeat count with no command (e.g.
valkey-benchmark 10000) builds an empty command sequence but still starts the benchmark. With nothing to send, the event loop spins forever at ~100% CPU printing-nan.Guard against this by checking seq_len before running: if no command was parsed, print a usage error and exit 1 instead of looping.
For example, before this change:
After this change: