TestWorkflowEnvironment doesn't respect activity ScheduleToCloseTimeout

In about 0,1% cases TestWorkflowEnvironment doesn’t respect activity ScheduleToCloseTimeout and retries it infinitely, which leads to test’s failures.

Activity stub has settings:

  • ScheduleToCloseTimeout = 30 seconds
  • MaximumAttempts = 0
  • BackoffCoefficient = 1
  • InitialInterval = 5 seconds

Usual run looks like this:

Before run: Thu May 01 11:15:06 CEST 2025
Attempt 1 scheduled at: Thu May 01 11:15:06 CEST 2025
...
Attempt 6 scheduled at: Thu May 01 11:15:26 CEST 2025
After run: Thu May 01 11:15:41 CEST 2025

Because of time skipping test takes < 1 seconds.

However about 0,1% or runs look like this:

Before run: Thu May 01 11:15:06 CEST 2025
Attempt 1 scheduled at: Thu May 01 11:15:06 CEST 2025
...
Attempt 24454 scheduled at: Fri May 02 21:18:51 CEST 2025
java.util.concurrent.TimeoutException: executeTest() timed out after 30 seconds

Although > 24 hours of temporal time is passed since first activity attempt, temporalio doesn’t fails activity, which leads to test timeout.

Increasing test timeout to 60 seconds doesn’t help, so issue is not caused by temporal VS real time thing.

MVE:

Thanks for reporting (sorry for late response).
Can you update your pom to latest sdk version and see if you run into same problem?

Can you try also without using the explicitly defined retry policy, just set ScheduleToClose timeout. Another idea could be to reuse your testEnv rather than creating a new one for each test. Its pretty expensive to create test env and wondering if its some sort of possible issue with resource utilization on your laptop or similar that could be involved too

Hey Tihomir!
Tried all - still the same issue. Updated repo