Skip to content

Conversation

@marinov-code
Copy link
Contributor

@marinov-code marinov-code commented Jul 23, 2025

…await() times out — which is not guaranteed.

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

…await() times out — which is not guaranteed.

// Wait for the functions to start execution
await().untilAsserted(() -> assertThat(service.getNumberOfCurrentExecutions()).isEqualTo(2));
await().untilAsserted(() -> assertThat(service.getNumberOfCurrentExecutions()).isLessThanOrEqualTo(2));
Copy link
Member

Choose a reason for hiding this comment

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

I think with this change the test would continue too quickly.

The goal of this line is to wait until the tasks have started. await().untilAsserted repeatedly runs () -> assertThat(service.getNumberOfCurrentExecutions()).isEqualTo(2) until it succeeds (or times out).

Changing the assertion to .isLessThanOrEqualTo(2) would make the test continue before both tasks have started, which I think is not what we want.

Do you see it time out? Perhaps we need to give it some more time before it gives up waiting for both tasks to start?

Copy link
Contributor Author

@marinov-code marinov-code Jul 23, 2025

Choose a reason for hiding this comment

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

Hi @raboof, thank you for your review. I agree, it's better to keep the isEqualTo(2). I pushed a new fix replacing the CompletableFuture.supplyAsync() with fixed thread pool executor.

CompletableFuture.supplyAsync() uses the common ForkJoinPool, which may not have enough threads for all concurrent executions which will cause await().assertThat(service.getNumberOfCurrentExecutions()).isEqualTo(2) to timeout.

…utor. CompletableFuture.supplyAsync() uses the common ForkJoinPool, which may not have enough threads.
@marinov-code marinov-code changed the title Those tests have a race condition: it assumes all tasks start before … Replacing CompletableFuture.supplyAsync() with fixed thread pool executor. CompletableFuture.supplyAsync() uses the common ForkJoinPool, which may not have enough threads. Jul 23, 2025
@marinov-code marinov-code requested a review from raboof July 23, 2025 20:32
@semioticrobotic
Copy link
Contributor

@CalvinKirs: Are you able to run the required workflows here? We're interested in determining whether the proposed patch fixes the tests.

@marinov-code
Copy link
Contributor Author

Just a note, initially I couldn't reproduce the timeout issue locally. However after adding the following at geode-wan/build.gradle :

test {
  jvmArgs += [
          '-XX:ActiveProcessorCount=4'
  ]
}

I'm able to reproduce the issue every time I run the tests.

@CalvinKirs
Copy link
Member

@CalvinKirs: Are you able to run the required workflows here? We're interested in determining whether the proposed patch fixes the tests.

done...thank you for your contribution

…utor. CompletableFuture.supplyAsync() uses the common ForkJoinPool, which may not have enough threads.
@marinov-code
Copy link
Contributor Author

marinov-code commented Jul 25, 2025

Hi @CalvinKirs, thank you for running the workflows but the build failed due to formatting issues. I just pushed a fix can you please run the workflows again?

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

It looks like with this change indeed the develop / unitTest tests all succeed, cool!

(acceptanceTest and integrationTest still fail, but that's likely a different issue)

@semioticrobotic
Copy link
Contributor

(acceptanceTest and integrationTest still fail, but that's likely a different issue)

Yes, but @marinov-code is working diligently on this and has a fix in the works!

@raboof raboof merged commit 0ee463d into apache:develop Aug 15, 2025
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants