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

Synchronize on the manager in RepositoryHelper#createMemoryComposite #415

Merged
merged 1 commit into from Dec 16, 2023

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented Dec 16, 2023

Currently the RepositoryHelper#createMemoryComposite uses the current time millis to generate a "unique" URI, but this has several issues:

Two threads can enter the method at the same time and then see that this "unique" id is currently not taken and then get the same id. It can even happen that both try to create them at the same time, what then will result in a provision exception what will return null and results in no composite created at all.

This do the following to mitigate this:

  • uses a UUID instead of timestamp where collisions are already unlikely
  • synchronize on the manager for the time of test/create the repository

Currently the RepositoryHelper#createMemoryComposite uses the current
time millis to generate a "unique" URI, but this has several issues:

Two threads can enter the method at the same time and then see that this
"unique" id is currently not taken and then get the same id.
It can even happen that both try to create them at the same time, what
then will result in a provision exception what will return null and
results in no composite created at all.

This do the following to mitigate this:
- uses a UUID instead of timestamp where collisions are already unlikely
- synchronize on the manager for the time of test/create the repository
Copy link

Test Results

       9 files  ±0         9 suites  ±0   29m 51s ⏱️ +59s
2 181 tests ±0  2 177 ✔️ ±0    4 💤 ±0  0 ±0 
6 633 runs  ±0  6 622 ✔️ ±0  11 💤 ±0  0 ±0 

Results for commit a5652b6. ± Comparison against base commit ba8f64a.

@laeubi laeubi merged commit a795c7f into eclipse-equinox:master Dec 16, 2023
9 checks passed
laeubi added a commit to eclipse-tycho/tycho that referenced this pull request Dec 17, 2023
github-actions bot pushed a commit to eclipse-tycho/tycho that referenced this pull request Dec 17, 2023
(cherry picked from commit e9676af)
laeubi added a commit to eclipse-tycho/tycho that referenced this pull request Dec 17, 2023
(cherry picked from commit e9676af)
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.

None yet

1 participant