Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yield actor thread between retries #10844

Merged
merged 4 commits into from Oct 31, 2022
Merged

Yield actor thread between retries #10844

merged 4 commits into from Oct 31, 2022

Conversation

npepinpe
Copy link
Member

Description

Ensures retry strategies are yielding their thread between retries. Note that this doesn't really apply to the BackOffRetryStrategy, as it's already yielding via its usage of timers.

This PR also updates the RetryStrategyTest to junit 5, and adds test coverage by applying the existing tests to the other strategies where applicable (previously, only the RecoverableRetryStrategy and AbortableRetryStrategy were tested there).

Related issues

closes #10539

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/1.3) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement
  • If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting.

Please refer to our review guidelines.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2022

Test Results

   949 files  ±  0     949 suites  ±0   1h 44m 53s ⏱️ + 4m 11s
7 632 tests  - 70  7 625 ✔️  - 70  7 💤 ±0  0 ±0 
7 830 runs   - 70  7 821 ✔️  - 70  9 💤 ±0  0 ±0 

Results for commit d2999fd. ± Comparison against base commit dfae49f.

♻️ This comment has been updated with latest results.

@npepinpe
Copy link
Member Author

As discussed, the BackOffRetryStrategy relies on the caller to prevent interleaving. I didn't change this here, but it's more explicit since we document that we're not testing that. If we want to do this, it shouldn't be too hard, but we'll have to buffer the execution as part of the strategy. I figured that was out of scope here.

Copy link
Contributor

@deepthidevaki deepthidevaki left a comment

Choose a reason for hiding this comment

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

🚀 As you said, I don't think we have to ensure BackoffStrategy doesn't interleave tasks. 👍

/** Ensure we use a single thread to better control the scheduling in the tests. */
@RegisterExtension
private final ControlledActorSchedulerExtension schedulerRule =
new ControlledActorSchedulerExtension(
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@npepinpe
Copy link
Member Author

bors merge

zeebe-bors-camunda bot added a commit that referenced this pull request Oct 31, 2022
10844: Yield actor thread between retries r=npepinpe a=npepinpe

## Description

Ensures retry strategies are yielding their thread between retries. Note that this doesn't really apply to the `BackOffRetryStrategy`, as it's already yielding via its usage of timers.

This PR also updates the `RetryStrategyTest` to junit 5, and adds test coverage by applying the existing tests to the other strategies where applicable (previously, only the `RecoverableRetryStrategy` and `AbortableRetryStrategy` were tested there).

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10539 



Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@npepinpe
Copy link
Member Author

bors r+

zeebe-bors-camunda bot added a commit that referenced this pull request Oct 31, 2022
10844: Yield actor thread between retries r=npepinpe a=npepinpe

## Description

Ensures retry strategies are yielding their thread between retries. Note that this doesn't really apply to the `BackOffRetryStrategy`, as it's already yielding via its usage of timers.

This PR also updates the `RetryStrategyTest` to junit 5, and adds test coverage by applying the existing tests to the other strategies where applicable (previously, only the `RecoverableRetryStrategy` and `AbortableRetryStrategy` were tested there).

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10539 



Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@npepinpe
Copy link
Member Author

The self-hosted runner: actions-runner-16-n5tz8-7chz2 lost communication with the server. Verify the machine is running and has a healthy network connection. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

:')

bors r+

@zeebe-bors-camunda
Copy link
Contributor

Build succeeded:

@zeebe-bors-camunda zeebe-bors-camunda bot merged commit b8e2293 into main Oct 31, 2022
@zeebe-bors-camunda zeebe-bors-camunda bot deleted the 10539-yield-retry branch October 31, 2022 15:06
@backport-action
Copy link
Collaborator

Backport failed for stable/8.0, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin stable/8.0
git worktree add -d .worktree/backport-10844-to-stable/8.0 origin/stable/8.0
cd .worktree/backport-10844-to-stable/8.0
git checkout -b backport-10844-to-stable/8.0
ancref=$(git merge-base dfae49fafe0f9dd3ba8fbeae1781dab418d5ce1d d2999fd9dd2999ba9610052cebae0c25d59716b4)
git cherry-pick -x $ancref..d2999fd9dd2999ba9610052cebae0c25d59716b4

@backport-action
Copy link
Collaborator

Successfully created backport PR #10866 for stable/8.1.

zeebe-bors-camunda bot added a commit that referenced this pull request Oct 31, 2022
10866: [Backport stable/8.1] Yield actor thread between retries r=npepinpe a=backport-action

# Description
Backport of #10844 to `stable/8.1`.

relates to #10539

Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
zeebe-bors-camunda bot added a commit that referenced this pull request Nov 1, 2022
10869: [Backport stable/8.0] Yield actor thread between retries r=deepthidevaki a=npepinpe

# Description
Backport of #10844 to `stable/8.1`.

relates to #10539

# Conflicts

I had to backport the `ControlledActorSchedulerExtension`, mostly, but I think that'll be useful in the future for backporting other things (maybe). There was nothing special for the actual test/PR itself.

Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
@korthout korthout added the version:8.1.3 Marks an issue as being completely or in parts released in 8.1.3 label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version:8.1.3 Marks an issue as being completely or in parts released in 8.1.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RetryStrategies do not yield
4 participants