Skip to content

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

Merged
siddique-adobe merged 7 commits into
adobe:dev-v3.0.2from
siddique-adobe:MOB-21074
Aug 6, 2024
Merged

siddique-adobe merged 7 commits into
adobe:dev-v3.0.2from
siddique-adobe:MOB-21074

Conversation

@siddique-adobe

Copy link
Copy Markdown
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

@spoorthipujariadobe spoorthipujariadobe left a comment

Copy link
Copy Markdown
Contributor

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

@spoorthipujariadobe spoorthipujariadobe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pending approval from Praveen

@spoorthipujariadobe spoorthipujariadobe left a comment •

Copy link
Copy Markdown
Contributor

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?

@praveek praveek left a comment

Copy link
Copy Markdown
Contributor

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
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