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

[MOB-21074] Fix threading issues during map updates in updateProposition #87

Merged
merged 7 commits into from
Aug 6, 2024

Conversation

siddique-adobe
Copy link
Contributor

Description

Changing the hash map to concurrent hash map in order to ensure the thread safety and avoid the race condition

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@spoorthipujariadobe spoorthipujariadobe changed the base branch from main to dev-v3.0.2 July 24, 2024 22:02
Copy link
Contributor

@spoorthipujariadobe spoorthipujariadobe left a comment

Choose a reason for hiding this comment

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

Could you please fix the lint errors?

…ionsInProgress hashmaps to static and final hashmaps
Copy link
Contributor

@spoorthipujariadobe spoorthipujariadobe left a comment

Choose a reason for hiding this comment

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

Pending approval from Praveen

Copy link
Contributor

@spoorthipujariadobe spoorthipujariadobe left a comment

Choose a reason for hiding this comment

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

Looking at this a bit more, I still don't think it is thread-safe. cachedPropositions is read from a different thread than the Optimize extension one, inside the SerialWorkDispatcher. We might also need to use ConcurrentHashMap for that. Thoughts?

Copy link
Contributor

@praveek praveek left a comment

Choose a reason for hiding this comment

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

Similar changes are also needed for cachedPropositions as it is also accessed from multiple threads.

…ucture of cachedPropositions to ConcurrentHashMap from hashmap
…ization and updating the comments accordingly
@siddique-adobe siddique-adobe merged commit d7ff94f into adobe:dev-v3.0.2 Aug 6, 2024
6 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
Development

Successfully merging this pull request may close these issues.

3 participants