Repository navigation
FELIX-6880: Sort a copy of the service property array in MultiPropertyFilterIndex - #599
Merged
paulrutter merged 1 commit intoNov 25, 2026
Conversation
…yFilterIndex getPermutations sorted the array it received. For the objectClass property that array is the live array of the service registration. Adapter components also share one such array between all children. Threads that start services in parallel can sort it at the same time. A concurrent sort can duplicate one name and lose another, so the index files the service under a wrong key. Sort a copy instead. Add a test that checks the array of the service reference stays unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvNRqvkmhBx6EjmxH35aB4
Contributor
Author
|
@pderop This is the PR for the second race. I'm still running tests against it (including your PR) to see if it's actually fixed now. |
Contributor
|
yesterday, I was busy, but I'll review today. thanks Paul! |
Contributor
Author
Thanks! My test finished, 500 runs, no exceptions and no stalls 🎉 |
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.
https://issues.apache.org/jira/browse/FELIX-6880
Problem
MultiPropertyFilterIndex.getPermutations sorts the array it receives, in place. For the objectClass property this array is the live array of the service registration. The framework returns it without a copy. Adapter components also share one array between all their children. If threads start services in parallel, they can sort the same array at the same time. A concurrent sort can duplicate one name and lose another, so the index files the service under a wrong key.
Fix
getPermutations now sorts a copy of the array (clone()).
Test
New test objectClassArrayOfReferenceIsNotModified in MultiPropertyFilterIndexReferencedTest. It checks that the array of the service reference is unchanged after addedService.
What is proven and what is not
Proven:
Not proven:
createKeys also sorts the property keys in place. That is safe today because the framework returns a copy of the keys, so it is not changed here.
🤖 Generated with Claude Code