Skip to content

Fix some flakiness tests#14303

Merged
sundb merged 1 commit intoredis:unstablefrom
sundb:fix_flakiness_test
Aug 27, 2025
Merged

Fix some flakiness tests#14303
sundb merged 1 commit intoredis:unstablefrom
sundb:fix_flakiness_test

Conversation

@sundb
Copy link
Copy Markdown
Collaborator

@sundb sundb commented Aug 26, 2025

This PR mainly fixes two flakiness tests.

  1. Fix the failure of Active Defrag HFE with ebrax test in memefficiency.tcl
    When redisObject structure size changes, the current test design becomes flakiness:
    In the current test, we will create 1 hash key + N string keys. When we delete this string key, these hash keys may be evenly distributed in robj 's slabs, resulting in the inability to perform defragmentation.

  2. Fix bulk reply protocol test in protocol.tcl introduced by Fix index error of CRLF when replying with integer-encoded strings #13711
    When OBJ_ENCODING_EMBSTR_SIZE_LIMIT (currently 44) changes, it can cause this test to fail. This isn't necessarily a problem, but the main issue is that we use rawread to verify encoding correctness. If the reply length doesn't match exactly, it can cause the test to hang and become difficult to debug.

@sundb sundb requested review from Copilot and oranagra and removed request for Copilot August 26, 2025 02:54
@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Aug 26, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

This comment was marked as outdated.

@kaplanben
Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details92dab413-cb49-419f-b076-4c61b00f9b20

New Issues (6)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /deps/linenoise/linenoise.c: 1200
detailsThe buffer buf created in /deps/linenoise/linenoise.c at line 1200 is written to a buffer in /deps/hiredis/sds.c at line 97 by sh, but an error i...
ID: oykVSjUcVC%2FEMplDwW4P3YG7%2FzE%3D
Attack Vector
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 3677
detailsThe buffer buf created in /src/redis-cli.c at line 3677 is written to a buffer in /deps/hiredis/sds.c at line 234 by hdrlen, but an error in cal...
ID: zN%2FI3F1XTVrKpHuopU6EZZmWXt4%3D
Attack Vector
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 3677
detailsThe buffer buf created in /src/redis-cli.c at line 3677 is written to a buffer in /deps/hiredis/sds.c at line 234 by newsh, but an error in calc...
ID: %2BpSSxZAM7xfUiads1egmyYebO5I%3D
Attack Vector
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 10594
detailsThe buffer argv created in /src/redis-cli.c at line 10594 is written to a buffer in /deps/hiredis/sds.c at line 97 by sh, but an error in calcul...
ID: eStOv%2FTaWfWWBCJCCgzT7mgYJU0%3D
Attack Vector
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /deps/linenoise/linenoise.c: 1166
detailsThe buffer fgetc created in /deps/linenoise/linenoise.c at line 1166 is written to a buffer in /deps/hiredis/sds.c at line 97 by sh, but an error...
ID: v3h9G7I8PLSutWNyC8k4gGzAdDA%3D
Attack Vector
MEDIUM Divide_By_Zero /src/redis-cli.c: 6040
detailsThe application performs an illegal operation in clusterManagerNodeMasterRandom, in /src/redis-cli.c. In line 6053, the program attempts to divi...
ID: Wdmj3BiFZXbdNClmOY%2Fr1waYywk%3D
Attack Vector
Fixed Issues (4)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 3677
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 3677
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 3677
CRITICAL Buffer_Overflow_Wrong_Buffer_Size /src/redis-cli.c: 3677

@sundb sundb requested a review from Copilot August 26, 2025 03:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses two flaky test cases that were causing unreliable test results. The first fix modifies the active defragmentation test to create hash keys instead of string keys for better fragmentation patterns. The second fix removes encoding verification checks that were sensitive to changes in Redis's internal encoding thresholds.

  • Replaced string key creation with hash key creation in the memory efficiency defrag test to ensure consistent fragmentation behavior
  • Removed object encoding verification checks from the protocol test to eliminate dependency on internal encoding size limits
  • Updated comment references to match the modified test operations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/unit/protocol.tcl Removes object encoding assertions that depend on internal encoding size limits
tests/unit/memefficiency.tcl Changes test to use hash keys instead of string keys for more predictable defragmentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sundb sundb merged commit 35aacdf into redis:unstable Aug 27, 2025
20 checks passed
@sundb sundb added this to Redis 8.4 Aug 27, 2025
@sundb sundb moved this from Todo to Done in Redis 8.4 Oct 24, 2025
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.

4 participants