Pierre De Rop created FELIX-6881:
------------------------------------
Summary: ClassCastException in
MultiPropertyFilterIndex.handleServiceRemove when several services share an
index key
Key: FELIX-6881
URL: https://issues.apache.org/jira/browse/FELIX-6881
Project: Felix
Issue Type: Bug
Components: Dependency Manager
Reporter: Pierre De Rop
MultiPropertyFilterIndex.handleServiceRemove throws a ClassCastException when a
service is unregistered while another service still shares one of its index
keys.
The else branch casts reference (the ServiceReference being removed) to
ArrayList instead of references (the list for that key):
((ArrayList) reference).trimToSize();
Impact
- The exception is silently swallowed by ServiceTracker, so nothing is logged.
- The loop over the keys stops at the first non-empty key. The remaining keys
keep the ServiceReference of the unregistered service, which causes a memory
leak and indexed lookups returning stale references.
Example
Index on objectClass, S1 with objectClass=[A,B], S2 with objectClass=[A].
Unregistering S1 throws on key {A}, and keys {A,B} and {B} keep S1 forever.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)