Repository navigation
FELIX-6817 Find no resources in a closed bundle revision - #577
Open
sharanggupta wants to merge 1 commit into
Open
sharanggupta wants to merge 1 commit into
sharanggupta wants to merge 1 commit into
Conversation
A lookup through the class loader of a wiring can still reach the revision after a refresh closed it. The content path was then rebuilt from the null content and cached as a list holding null, so getResourceLocal() failed with a NullPointerException. A closed revision now has an empty content path, which is not cached since the refresh can reopen the revision.
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.
Fixes FELIX-6817.
The
NullPointerExceptionin the report (Content.hasEntry(String)called on anullelement of the content path, fromBundleRevisionImpl.getResourceLocal) happens when a resource lookup through the class loader of a wiring reaches the revision after a refresh has closed it.BundleWiringImpl.findClassOrResourceByDelegation()checks that the wiring is not disposed before it callsBundleClassLoader.findResource(), but a concurrent refresh can close the revision in between.close()sets the content tonulland drops the content path.getContentPath()then rebuilds the path from thenullcontent:MultiReleaseContent.wrap()swallows the resulting exception and returnsnull, so the cached path is a list holdingnull, and every later lookup on that revision fails the same way.initializeContentPath()now returns an empty content path for a closed revision, so the lookup finds nothing, likegetResourcesLocal()already does when there is no content path. The empty path is not cached, because a refresh closes all revisions of the bundle and then reopens the current one withresetContent(), after which the path must be computed again.Test:
ResourceLoadingTest.resourceLoadingFromClosedRevisionFindsNothingkeeps the class loader of a bundle's wiring, updates and refreshes the bundle, and then callsfindResource()andfindResources()on the old class loader, which is the state the race leads to. Onmasterit fails with theNullPointerExceptionfrom the report; with the change it passes, andmvn clean verifyof the framework module passes locally.