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: fix concurrency issue #1336

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

FreddyDevelop
Copy link
Contributor

Description

With current implementation of the flow builder and how it is used, each request shared the same flow instance, this leads to a concurrency issue, because the flow instance holds the database transaction and http context of a request. And when all incoming request share the same flow instance, the transaction and http context get overridden and also we get a concurrency write error on the contextValue variable in the flow.

Implementation

Create a new instance of a flow for each incoming request. The scanFlowStates function from the defaultFlowBuilder is changed, that this only runs once.

Tests

Call an endpoint e.g. /registration automated (concurrent) many times (at least one action should be used e.g. register_client_capabilities). Check that no errors occur.

@FreddyDevelop FreddyDevelop merged commit ac8d1d8 into introduce_flowpilot Feb 14, 2024
@FreddyDevelop FreddyDevelop deleted the fix-concurrency-problem branch February 14, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants