paulrutter opened a new pull request, #599: URL: https://github.com/apache/felix-dev/pull/599
## 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. - Without the fix: the test fails. - With the fix: all 8 tests in the class pass. ## What is proven and what is not Proven: - The in-place sort of a shared array. - A plain Java test with two threads sorting the same unsorted 4-name array (300000 rounds) corrupted 2 arrays. - The new unit test fails without the fix and passes with it. Not proven: - That this race caused a startup stall that was seen once in about 150 runs of parallel startup. It is a possible cause, but this is not confirmed. 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](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
