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

Maintaining thread safety for class med properties #2207

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

malakaganga
Copy link
Contributor

Purpose

Since expressions such as expression="get-property('...')" or expression="$trp:..." are dynamic and their values can change with each request, we face a potential race condition when these expressions alter instance variables using setters. Given that only one instance of the class mediator is created and shared among multiple concurrent requests, this shared state can lead to inconsistent behavior and data corruption.
To mitigate this, we need to ensure synchronization not only when the content is altered by expression but also for each evaluation of these dynamic expressions. This ensures that changes made by one request do not interfere with or get overwritten by another concurrent request, maintaining thread safety and data integrity across all operations.

Fixes: wso2/product-ei#5292

Since expressions such as expression="get-property('...')" or expression="$trp:..."
are dynamic and their values can change with each request, we face a potential
race condition when these expressions alter instance variables using setters.
Given that only one instance of the class mediator is created and shared among multiple
concurrent requests, this shared state can lead to inconsistent behavior and
data corruption.
To mitigate this, we need to ensure synchronization not only when the content
is altered by expression but also for each evaluation of these dynamic expressions. This ensures
that changes made by one request do not interfere with or get overwritten by
another concurrent request, maintaining thread safety and data integrity across all operations.

Fixes: wso2/product-ei#5292
@malakaganga malakaganga merged commit d7930d3 into wso2:master Jul 25, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants