Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Tests] Vector-set tests wait for replica AOF sync while VSIM is still running

Closed
#2,223 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@kevin-montrose is already working on this.

Since Oct 8, 2026.

  • #2224 by @yuseok-kim-edushare — open

Assessment

This issue has not been assessed yet.

Description

Describe the bug

ClusterVectorSetTests calls WaitForReplicaAofSync while a tight VSIM loop is still running on the replica. The replica publishes its AOF offset only after in-flight VADD replay finishes (WaitForVectorOperationsToComplete). If that replay does not return, the offset stays at the start of the current batch and the sync wait polls until the test timeout. There is no progress check.

On windows-latest / net8.0 / Release, ClusterVectorSetTests(1000).MultipleReplicasWithVectorSetsAsync failed at 180.1s:

[127.0.0.1:18848]: 1,544088 != [127.0.0.1:18852]: 1,535384

WaitForReplicaAofSync → BackOff → Assert.Fail. One replica (18852) was 8704 bytes behind the primary. Both sides were store version 1. On that same job, the (0) fixture of this test passed in 24.8s, and (1000).MultipleReplicasWithVectorSetsAndDeletesAsync passed in 33.2s.


The CI failure text is the one in the description. Stack:

at ClusterTestUtils.BackOff(...) in test/cluster/Garnet.test.cluster/ClusterTestUtils.cs:line 787
at ClusterTestUtils.WaitForReplicaAofSync(...) in test/cluster/Garnet.test.cluster/ClusterTestUtils.cs:line 3387
at ClusterVectorSetTests.MultipleReplicasWithVectorSetsAsync() in test/cluster/Garnet.test.cluster.vectorsets/VectorSets/ClusterVectorSetTests.cs:line 654
Steps to reproduce the bug
  1. Build Debug (ExceptionInjectionHelper is compiled out of Release).
  2. Park the replica inside ApplyVectorSetAdd, before replicationBlockEvent is decremented, so the AOF consumer cannot publish the end offset of the batch. A ResetAndWait injection at the start of that method does this.
  3. Start one primary and one replica with AOF enabled. VADD one 75-byte XB8 vector with XPREQ8.
  4. Wait until the injection has parked the replay task.
  5. Call WaitForReplicaAofSync with a test CTS of a few seconds.

The wait fails with an Assert.Fail message containing != and the two offsets. Re-enable the injection so the replay task leaves the park, then call WaitForReplicaAofSync again. The second call succeeds.

The same order, without an injection, is what CI hit: VSIM is cancelled only after WaitForReplicaAofSync in these methods.

  • ConcurrentVADDReplicatedVSimsAsync
  • MultipleReplicasWithVectorSetsAsync
  • MultipleReplicasWithVectorSetsAndDeletesAsync
Expected behavior

Replica VSIM should be stopped and its task awaited after the primary writes finish, and only then should the test wait for AOF sync. A replay that is still inside the current batch should not sit on the sync loop until [CancelAfter] fires. Search hit counts should be the hits collected while the primary write was still running.

Screenshots

No response

Release version

v2.2.1 and current main (77d677099 at the time of the run). The failing test was added in #2032.

IDE

Not an IDE failure. GitHub Actions, dotnet test of Garnet.test.cluster.vectorsets (windows-latest, net8.0, Release). in https://github.com/microsoft/garnet/actions/runs/37767292226
and some other CI's flaky

OS version

Win 11 26H2(26300) and github actions hosted windows-latest

Additional context

Eighty repeats on a local Windows dev box (net8/net10, Debug and Release, 20 each) passed in 11.7–19.0s, so this is not the normal runtime of the (1000) fixture.

Other WaitForReplicaAofSync call sites under test/cluster cancel and await background command loops before sync. A test-only fix is on yuseok-kim/stop-vsim-before-aof-sync (5ede9d27a): cancel VSIM and await those tasks, then sync. Debug / net8.0 ran the three methods, both fixtures, including both withAttributes cases: 8 passed in 70s.

Dominant language
C#
Stars
12.1k
Forks
716
Avg merge
2d 21m
Merged PRs (30d)
57

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/garnet

All issues in microsoft/garnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.