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

fix: create new readers and writer for every sync request #10037

Merged

Conversation

lenaschoenburg
Copy link
Member

Description

Applies the fix in #10026 for sync api handlers too.

Due to our actor scheduler, even sync handlers can't reuse readers andwriters because onComplete on the already completed future doesn't run immediately, causing a data race on the readers and writers when handling concurrent requests.

Related issues

closes #10014

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 Aug 9, 2022

Test Results

   811 files  ±    0     811 suites  ±0   1h 42m 17s ⏱️ - 1m 37s
6 003 tests  - 126  5 992 ✔️  - 127  10 💤 ±0  1 +1 
6 191 runs   - 126  6 180 ✔️  - 127  10 💤 ±0  1 +1 

For more details on these failures, see this check.

Results for commit caefea7. ± Comparison against base commit 7f1134c.

♻️ This comment has been updated with latest results.

Due to our actor scheduler, even sync handlers can't reuse readers and
writers because `onComplete` on the already completed future doesn't
run immediately, causing a data race for concurrent requests.
@lenaschoenburg lenaschoenburg force-pushed the 10014-create-readers-writes-on-sync-requests branch from fbf6f7d to fab336e Compare August 9, 2022 11:31
@lenaschoenburg lenaschoenburg marked this pull request as ready for review August 9, 2022 12:06
This indirection was more confusing than helpful. All handlers are
effectively async, even if their `handleAsync` implementation could be
sync.
Copy link
Contributor

@pihme pihme left a comment

Choose a reason for hiding this comment

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

Looks good!

@lenaschoenburg
Copy link
Member Author

bors r+

zeebe-bors-camunda bot added a commit that referenced this pull request Aug 9, 2022
10037: fix: create new readers and writer for every sync request r=oleschoenburg a=oleschoenburg

## Description

Applies the fix in #10026 for sync api handlers too.

Due to our actor scheduler, even sync handlers can't reuse readers andwriters because `onComplete` on the already completed future doesn't run immediately, causing a data race on the readers and writers when handling concurrent requests.

## Related issues

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

closes #10014 



Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@lenaschoenburg
Copy link
Member Author

runner crashed

bors r+

zeebe-bors-camunda bot added a commit that referenced this pull request Aug 9, 2022
10037: fix: create new readers and writer for every sync request r=oleschoenburg a=oleschoenburg

## Description

Applies the fix in #10026 for sync api handlers too.

Due to our actor scheduler, even sync handlers can't reuse readers andwriters because `onComplete` on the already completed future doesn't run immediately, causing a data race on the readers and writers when handling concurrent requests.

## Related issues

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

closes #10014 



Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@lenaschoenburg
Copy link
Member Author

Ugh,

bors r+

@zeebe-bors-camunda
Copy link
Contributor

Build succeeded:

@zeebe-bors-camunda zeebe-bors-camunda bot merged commit c5a0870 into main Aug 9, 2022
@zeebe-bors-camunda zeebe-bors-camunda bot deleted the 10014-create-readers-writes-on-sync-requests branch August 9, 2022 14:26
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.

NullPointerException upon writing error response
2 participants