GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor JGroups pull state logic and update cluster documentation by diegolovison · Pull Request #998 · Hyperfoil/Hyperfoil

Conversation

@diegolovison

@diegolovison diegolovison commented Nov 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Partial fix: #993 ( the issue was updated )

Done:

  • Correctness: repullState() has no pendingOps guard
  • Test coverage: "removed queue still passes / needs a failing test"
  • All 5 stale comments/docs items
  • The minor mutate()/writeLock javadoc item

Open:

  • JGroupsChaosTest injects faults below NAKACK2/UNICAST3
  • JGroupsChaosTest's pending-op queue is never exercised

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
franz1981
franz1981 requested changes Nov 20, 2026
View reviewed changes

@franz1981 franz1981 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks Diego, the repullState guard does fix the race from #993. With the PR's tests on master production code
(plus only the no-op beforePullResponsesApplied hook so the test base compiles), RepullStateRaceTest fails
20/20, and on head it passes every run. A few things before merging:

  1. The coalescing in repullState() drops a second repull. If a pull is already in flight, the new code returns,
    but that pull was cast to the previous view, so a member readmitted by a later view change is never asked. On
    master, both pulls ran. I wrote a scratch test with nodes peer/Q/X. Peer has lost X's slice (purge+admit, like
    RepullStateRaceTest). X's unicasts are muted (DISCARD above UNICAST3), peer runs repull #1, X is unmuted after
    500 ms, and peer runs repull #2. On master, X's data is back at ~502 ms (3/3). On head, it is still missing after
    30 s (3/3). Suggested fix: when beginPull() finds a pull in flight, set a repullRequested flag under
    pullLock. After completePull drains, if it is set, pull again. That also closes the existing gap where a
    readmit during the join pull is skipped.

  2. shouldConvergeWhenNodeJoinsMidWorkloadUnderDelay never queues anything. I added a temporary print of the
    pendingOps size in endPull. It shows queued=1 in JoinPullRaceTest and RepullStateRaceTest, but
    queued=0 at every node in 8/8 runs of this test. With beginPull() removed from join(), JoinPullRaceTest
    fails 5/5 and this test passes 5/5. So the Javadoc's "forcing the system to use the pendingOps queue" is not true
    today. Either make it overlap for real and assert that something was queued, or drop the claim. JoinPullRaceTest
    already covers that #993 item.

  3. Repulls now hold every delta until the pull completes. With one unresponsive member, that is the full 5 s.
    Muting one node's unicasts and registering a consumer on a healthy node: the registration showed up at the pulling
    node after ~4.8 s on head (5/5), versus ~28 ms on master (3/3). This is probably the right trade, but please
    document it next to pendingOps.

  4. Please keep the original Javadoc and add only what the issue asked for. The rewrite drops rationale:

    • why repullState exists at all (tombstone plus early announcement)
    • the MFC-blocking note in mutate, which is the actual cost of the trade-off the issue asked to document
    • the SHUFFLE max_time default note

    Also, "If we put faults above NAKACK2, the tests would fail" needs either a run behind it or a softer wording.

  5. Teardown. The assertions still run after heal() and poll, so I don't see it hiding failures. For what it's worth, I measured it: with master's teardown order, SHARED_LOOPBACK logs NullPointerException ... Protocol.up in 5/5 chaos runs, and with yours in 1/20. So it does help, but that belongs in the commit message. Also note that in JGroups 5.5.7 DELAY's
    handler thread never exits. It is for(;;) around a non-blocking drainTo, and every exception is swallowed. A
    scratch test showed it still alive after destroy() and burning ~995 ms of CPU per second. With the new test,
    by my count of instances (I did not take a thread dump), each chaos run leaves 6 of them spinning in the surefire JVM. The new comment suggests the thread "finishes its
    work". It doesn't.

  6. Smaller items:

    • Make beforePullResponsesApplied/afterSliceEncoded package-private rather than protected API.
    • The reflection helpers only target Hyperfoil's own members (nothing JGroups-internal). ClusterState.purge/admit
      are package-private already, so a package-private state() accessor would let the compiler catch renames.
    • newManager(String, Runnable...) now ignores every hook after the first.
    • The PR description should state the problem and the evidence, and say which #993 items are addressed or
      declined (faults above NAKACK2).
    • Please squash the 9 commits ("Refection refactor", "format", ...) into one, or fix+tests and docs.

The docs changes (hyperfoil default name, node_name uniqueness, ClusterState locking) match the code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/main/java/io/hyperfoil/clustering/jgroups/JGroupsClusterManager.java Outdated
if (pendingOps != null) {
return;
}
if (!beginPull()) {

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This drops a repull issued while another pull is in flight. That pull was cast to the earlier view, so a member readmitted later is never asked. Scratch test: master recovers X at ~502 ms (3/3), head never does within 30 s (3/3). Suggest a repullRequested flag that completePull honours after draining.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/main/java/io/hyperfoil/clustering/jgroups/JGroupsClusterManager.java Outdated
* would apply its deltas before the slice they were queued to follow, and {@link ClusterState} would then
* reject that slice as stale. A join already pulls for itself, so there is nothing to add.
* Calling {@link #beginPull} creates a new queue only if one does not already exist. If another
* pull is already running, this method does nothing (the other pull will handle the updates).

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

"the other pull will handle the updates" only holds if the other pull was cast to the same view. Please also keep the original paragraph explaining why repullState exists (tombstone plus early announcement).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/main/java/io/hyperfoil/clustering/jgroups/JGroupsClusterManager.java Outdated
* from peers, but before saving it. This helps test what happens when another data change
* ({@link #mutate}) happens at the exact same time. It does nothing in real production.
*/
protected void beforePullResponsesApplied() {

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Package-private instead of protected? Same for afterSliceEncoded. The tests are in the same package.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/test/java/io/hyperfoil/clustering/jgroups/JGroupsChaosTest.java Outdated
* <p>
* We use the {@code DELAY} fault here on purpose. It makes the network slow, which stretches the time
* it takes for the new node to download the full state. This creates a longer window of time for small
* data updates (deltas) to arrive during the download, forcing the system to use the {@code pendingOps} queue.

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Measured pendingOps size at drain: 0 at every node in 8/8 runs, and the test passes 5/5 with the join queue removed. It does not force the queue.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/test/java/io/hyperfoil/clustering/jgroups/JGroupsChaosTest.java Outdated
* <li><b>Testing realistic chaos:</b> By putting faults below NAKACK2, we test what happens
* on a real network. We prove that the system stays stable even if the raw network loses,
* duplicates, or reorders messages.</li>
* <li><b>Breaking the rules:</b> If we put faults <i>above</i> NAKACK2, the tests would fail.

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is there a run behind "the tests would fail"? If not, please phrase it as the design assumption.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/test/java/io/hyperfoil/clustering/jgroups/JGroupsChaosTest.java
// the network links and causes errors in the log.
// (The system would safely resend the lost message anyway, but we want to avoid messy log errors).
try {
Thread.sleep(200);

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

In 5.5.7, DELAY's handler thread never finishes: for(;;) around a non-blocking drainTo, and exceptions are swallowed. It stays alive after destroy() at ~1 core of CPU. The reordering does cut the SHARED_LOOPBACK NPEs (Protocol.up) from 5/5 runs to 1/20, so please say that in the comment or the commit message, not that the thread finishes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread clustering/src/test/java/io/hyperfoil/clustering/jgroups/ClusterManagerTestBase.java Outdated
* Use this for tests where you need to start the join process manually.
*/
protected JGroupsClusterManager newManager(String clusterName, Runnable... afterSliceEncoded) {
return newManager(clusterName, afterSliceEncoded.length == 0 ? null : afterSliceEncoded[0], null);

@franz1981 franz1981 Nov 20, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Silently ignores every hook after the first. Either keep the loop or change the signature to a single Runnable.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
diegolovison added 13 commits November 23, 2026 11:38
@diegolovison
Refactor JGroups pull state logic and update cluster documentation
03c63e4
@diegolovison
Refection refactor
f2bf666
@diegolovison
Add beforePullResponsesApplied test hook to ClusterManagerTestBase
9631eaf
@diegolovison
Update comment in ConcurrentRegistrationTest to reflect async mutate …
2d35494
…behavior
@diegolovison
Add mid-workload join test to JGroups chaos suite and fix fault teardown
46ae886
@diegolovison
Simplify Javadocs and comments for better readability
958583e
@diegolovison
JoinPullRaceTest
cb7dac2
@diegolovison
RepullStateRaceTest
a3a697d
@diegolovison
format
05409af
@diegolovison
Fix dropped state repulls in JGroupsClusterManager
d0d891b
@diegolovison
Address javadoc comments
9680440
@diegolovison
Address comment on shouldConvergeWhenNodeJoinsMidWorkloadUnderDelay
8c325c9
@diegolovison
Refactor: remove reflection
88ef3e8
@diegolovison
diegolovison force-pushed the jgroups_fixes branch from ecb482f to 88ef3e8 Compare November 23, 2026 17:08
@diegolovison

diegolovison commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

@jabolina if you could take a look at:

  • ClusterState.java -> https://github.com/Hyperfoil/Hyperfoil/pull/998/changes#diff-73493841b67299e182582422e12bc43a5f8720f08f0f52360973a539298597c2
  • JGroupsClusterManager.java -> https://github.com/Hyperfoil/Hyperfoil/pull/998/changes#diff-451d08d0127d225723e8d76bf144a63f84970b60041166d7a3d11e0c86c32637
  • LocalController.java -> https://github.com/Hyperfoil/Hyperfoil/pull/998/changes#diff-e00eaab452f6282f47a20c7ee1014e31fe00bc07327b0323a72e6ffe3f7d4934

The other changes are testing, you can skip if you wish.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@diegolovison diegolovison mentioned this pull request Nov 25, 2026
Bump JGroups to 5.5.8.Final #1010
Draft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@franz1981 franz1981 franz1981 requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

JGroups cluster manager - repullState race, test fault placement, stale docs/comments

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@diegolovison @franz1981
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.