Conversation
…lity In MaintainedResourceRepository and SpaceRepository, the volatile sentinel field (resourceList/spaceList) was set at the start of refresh(), making partially populated maps visible to concurrent readers. Build all data structures with local variables and assign the volatile field last, establishing a happens-before guarantee. Add double-check in ensureLoaded() to prevent redundant refreshes. Make SpaceRepository.runRootUpdateAfter volatile for cross-thread visibility. In Space, the shadow fields dataInitialized and dataNeedsUpdate were non-volatile, so writes from background update threads had no happens-before relationship with reads in the AjaxLazyLoadPanel polling thread, potentially causing isDataInitialized() to never return true. Closes #374 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ashleycaselli
approved these changes
Mar 5, 2026
|
🎉 This PR is included in version 4.15.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two related race conditions that caused maintained resources to fail loading on live instances:
Repository refresh race condition: In
MaintainedResourceRepositoryandSpaceRepository, the volatile sentinel field (resourceList/spaceList) was assigned at the start ofrefresh(), before the lookup maps were populated. Concurrent readers could see the non-null sentinel, skipensureLoaded(), and then access null/empty/partially-populated maps — causing NPEs or missing data. Fixed by building all data structures with local variables and assigning the volatile field last, establishing a happens-before guarantee for all prior writes. Also added double-check inensureLoaded()to prevent redundant refreshes, and madeSpaceRepository.runRootUpdateAftervolatile.Space field visibility:
Space.dataInitializedandSpace.dataNeedsUpdatewere non-volatile shadow fields written by background threads and read by the AjaxLazyLoadPanel polling thread without synchronization. Under the Java Memory Model, the polling thread could cache the stalefalsevalue indefinitely, causingisDataInitialized()to never returntrue. This was previously masked by the first bug (pages would crash before reaching the polling stage). Fixed by making both fieldsvolatile.Test plan
/resource?id=https://w3id.org/fair/fip/terms/FIP-Ontology)Closes #374
🤖 Generated with Claude Code