Skip to content

Skip the INCREX BYFLOAT overflow tests under Valgrind - #4898

Closed
madolson wants to merge 1 commit into
valkey-io:unstablefrom
madolson:skip-increx-overflow-valgrind
Closed

madolson wants to merge 1 commit into
valkey-io:unstablefrom
madolson:skip-increx-overflow-valgrind

Conversation

@madolson

Copy link
Copy Markdown
Member

Four INCREX BYFLOAT overflow tests in tests/unit/type/incr.tcl fail on every Valgrind daily run, and on the 9.2 backport sweep (#4884). Valgrind emulates x87 long double at 64-bit precision, so 1e4932 + 1e4932 never overflows to infinity and the overflow branch never runs. This tags the four tests valgrind:skip, the same tag their replication.tcl twin already got in #3253. Needs backporting to 9.2.

AI generated details

Problem

Failing jobs: https://github.com/valkey-io/valkey/actions/runs/38659153622 (test-valgrind-test (integration-type), test-valgrind-no-malloc-usable-size-test (integration-type)) and https://github.com/valkey-io/valkey/actions/runs/38624991727/job/116062250934. These four are the only [err] lines in those jobs.

INCREX was added in 6ae7eb4 (#3253), first released in 9.2.0-rc1. ldbl_overflow_operand (tests/support/util.tcl:1547) chooses 1e4932 because its probe, increx byfloat 0, still succeeds under Valgrind. The overflow check is isinf(value_ld) at src/t_string.c:915. Under Valgrind it is never true. A minimal program built with gcc 13 on Ubuntu 24.04 shows this:

native:   a=1e+4932 isinf(a)=0 s=inf isinf(s)=1 s-a=inf
valgrind: a=1.18973e+4932 isinf(a)=0 s=1.18973e+4932 isinf(s)=0 s-a=-nan

The server stores the finite sum, applies the command's TTL, and replies with a nan delta. The test assertions catch exactly that. The replication.tcl test INCREX BYFLOAT arithmetic overflow does not propagate is the same operation, and #3253 already tagged it valgrind:skip with a comment explaining why. The incr.tcl copies did not get the tag.

Alternative considered

Have ldbl_overflow_operand detect Valgrind and fall back to 1e308. That relies on Valgrind arithmetic matching double on every Valgrind version. It does not: under Valgrind 3.19 on Amazon Linux 2, 1e4932 is rejected as infinity and the tests pass. The tests would also stop exercising the long double range under Valgrind, so they would test nothing Valgrind can report on. Skipping is the existing convention for this file and the replication test.

Testing

Ran in ubuntu:24.04 with Valgrind 3.22 and gcc 13, which matches CI. ./runtest --single unit/type/incr --valgrind --clients 1 on the base fails like CI does:

[err]: INCREX BYFLOAT positive arithmetic overflow returns [curr_val, 0] in tests/unit/type/incr.tcl
Expected '0' to be equal to 'nan' (context: type eval line 8 cmd {assert_equal 0 [lindex $res 1]} proc ::test)
[err]: INCREX BYFLOAT negative arithmetic overflow returns [curr_val, 0] in tests/unit/type/incr.tcl
Expected '0' to be equal to 'nan' (context: type eval line 7 cmd {assert_equal 0 [lindex $res 1]} proc ::test)
[err]: INCREX BYFLOAT overflow preserves existing TTL in tests/unit/type/incr.tcl
Expected '1e4932' to be equal to '1189731495357231765085759326628007130763444687096510237472674821233261358180483686904488595472612039915115437484839309258897667381308687426274524698341565006080871634...
[err]: INCREX BYFLOAT overflow does not apply the command's expiration in tests/unit/type/incr.tcl
Expected '-1' to be equal to '60' (context: type eval line 7 cmd {assert_equal -1 [r ttl foo]} proc ::test)

With the patch, the same run reports all four as [ignore]: ... Not supported when running under Valgrind and passes. Without --valgrind, the same binary passes all four tests.

This was generated by AI but verified, with love, by a human.

The four INCREX BYFLOAT arithmetic overflow tests in incr.tcl fail every
day in the Valgrind jobs. Valgrind computes x87 long double arithmetic
at 64-bit precision, so 1e4932 + 1e4932 is not detected as an overflow:
the sum is stored, its TTL is changed, and the reply's delta is nan.

The replication.tcl twin of these tests was already tagged valgrind:skip
when INCREX was added, as were the neighboring inf/nan INCREX tests in
incr.tcl. Tag these four the same way.

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 15, 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: b8ed4093-e10a-4e80-9a4c-943a1767afcc
📥 Commits

Reviewing files that changed from the base of the PR and between 035b8d6 and 70891a1.

📒 Files selected for processing: 1
  • tests/unit/type/incr.tcl

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

📝 Walkthrough

The overflow tests in tests/unit/type/incr.tcl now include Valgrind skip annotations. A comment explains that Valgrind on x86 returns a finite result for 1e4932 + 1e4932.

Changes: Overflow test skips

Layer / File(s) Summary
Document and annotate Valgrind skips
tests/unit/type/incr.tcl
A comment describes the x86 Valgrind limitation. Skip annotations were added to the positive and negative arithmetic-overflow tests, the existing-TTL overflow test, and the test that checks command expiration after overflow.

Priority: ⬇️ Low

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

Merge Risk: ⚪ Minimal · up to 70891

The four overflow tests remain active in ordinary runs; this change only omits them during Valgrind runs, with no demonstrated merge-blocking regression.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: skipping INCREX BYFLOAT overflow tests under Valgrind.
Description check Passed The description directly explains the Valgrind failures, the test changes, the rationale for skipping, and the validation results.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@valkey-review-bot

Copy link
Copy Markdown
Contributor

Review state

Ready for human review.
No findings. The four tests that call ldbl_overflow_operand in incr.tcl are now tagged valgrind:skip. {} as the expected result is correct here because assert_equal and assert_range return an empty string. The tag follows the convention the neighboring inf/nan tests already use.

Risk: Low. Test-only change. The worst case is that the overflow tests no longer run in Valgrind jobs, which already cannot reach the overflow path.

Open findings: none.

Backport: Needed for 9.2. upstream/9.2 has these four tests in tests/unit/type/incr.tcl without valgrind:skip, so its Valgrind runs fail the same way. INCREX is not on 9.1 or older branches.

Updated for 70891a1 at 2026-10-15 22:04 UTC. The bot rewrites this comment on every review.

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.83%. Comparing base (035b8d6) to head (70891a1).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #4898      +/-   ##
============================================
+ Coverage     80.76%   80.83%   +0.07%     
============================================
  Files           195      195              
  Lines        102234   102234              
============================================
+ Hits          82569    82641      +72     
+ Misses        19665    19593      -72     

see 23 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.

@Baraa-Hasheesh

Copy link
Copy Markdown
Contributor

@madolson looks to be a duplicate of #4850

@JimB123

JimB123 commented Oct 16, 2026

Copy link
Copy Markdown
Member

Duplicate of #4850

@JimB123 JimB123 marked this as a duplicate of #4850 Oct 16, 2026
@JimB123 JimB123 closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants