-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[BUG] ParallelForEach Behavior Inconsistency #5389
Comments
To address the bug report regarding the From the code segment provided, it appears that the The expected behavior, as mentioned, is correct. Each iteration should indeed have its own isolated context, including its own instance of the To resolve this issue, the Elsa Workflow team would need to ensure that each iteration's context is properly isolated and that the If you are experiencing this issue with the latest version of Elsa Workflow, I would recommend reporting this issue on the Elsa Workflow GitHub repository, providing the details of the bug, including the code segment, the observed issue, and the expected behavior. The development team can then investigate and provide a fix or guidance on how to avoid such race conditions. Please let me know if you need further assistance or if there are any specific details you would like to discuss regarding this issue. This comment was generated by Glime. |
@sfmskywalker would you please take a look? Thanks. |
Description:
In the Elsa Workflow , I believe there's a potential issue with the
ParallelForEach
implementation. After examining the code, it seems that the usage ofCurrentValue
variable within the loop may lead to race conditions and incorrect behavior in multi-threaded scenarios.Code Segment:
Issue:
The concern arises from the fact that the
CurrentValue
variable is shared across iterations of the loop. Since each iteration schedules work asynchronously, there's a possibility of race conditions where one thread might modify theCurrentValue
before another thread can consume its value.Expected Behavior:
In a parallel loop like this, each iteration should have its own isolated context, including its own instance of the
CurrentValue
variable. This ensures that modifications made by one iteration do not affect the others.The text was updated successfully, but these errors were encountered: