fix: Added a shared in-progress VersionInfo returned to concurrent callers#2086
fix: Added a shared in-progress VersionInfo returned to concurrent callers#2086
Conversation
… once resolution starts
🚨 Code Formatting Issue 🚨This contribution does not follow the conventions set by the Google Java Style Guide. Please run the following command at the root of the project to fix formatting errors: ./gradlew spotlessApply🗂️ Affected files
Go to the Actions Dashboard to download the full Spotless output |
…tfs-validation-report
🚨 Code Formatting Issue 🚨This contribution does not follow the conventions set by the Google Java Style Guide. Please run the following command at the root of the project to fix formatting errors: ./gradlew spotlessApply🗂️ Affected files
Go to the Actions Dashboard to download the full Spotless output |
📝 Acceptance Test Report📋 Summary✅ The rule acceptance has passed for commit a41af17 📊 Notices ComparisonNew Errors (0 out of 978 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Errors (0 out of 978 datasets, ~0%) ✅No changes were detected due to the code change. New Warnings (0 out of 978 datasets, ~0%) ✅No changes were detected due to the code change. Dropped Warnings (0 out of 978 datasets, ~0%) ✅No changes were detected due to the code change. 🛡️ Corruption Check16 out of 994 sources (~2 %) are corrupted.
⏱️ Performance Assessment📈 Validation TimeAssess the performance in terms of seconds taken for the validation process.
📜 Memory Consumption
|
| * Keep a reference to the shared in-progress VersionInfo so concurrent callers don't get an empty | ||
| * instance. | ||
| */ | ||
| private volatile VersionInfo inProgressVersionInfo; |
There was a problem hiding this comment.
I'm not convinced that this will fix the issue. The VersionResolver class is instantiated only once because it's a singleton bean, see. Making the class a singleton and synchronizing the resolve methods ensures that only one thread accesses the resolve method at any given time.
I think the issue is that the web validator makes an HTTP request to retrieve the version. When this HTTP call fails, the version number is returned as null. This is done in the Validator runner called from validateFeed method. If we set skipValidatorUpdate to true in the call, the VersionResolver will not do the HTTP call and the version will be resolved "locally". This will avoid any failures and guarantees that version numbers are consistently available.
There was a problem hiding this comment.
I'll revisit this bug after stop_access schema update and feature addition.
Summary:
Closes #2021
Expected behavior:
Keep and return a single shared “in‑progress” VersionInfo once resolution starts. Set the current version synchronously before kicking off the background fetch of the latest release. If another request arrives during resolution, it gets the same instance (already carrying currentVersion) instead of an empty one.
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything