The OSGi™ Service Platform is becoming the de facto standard for modularized Java applications. The market of OSGi based Commercial-off-the-shelf components is continuously growing. OSGi specific problems make it harder to validate such components. The absence of separate object spaces to isolate components may lead to inconsistencies when they are stopped. The platform cannot ensure that objects from a stopped component will no longer be referenced by active code (a problem referred by OSGi specification as stale references) leading to memory retention and inconsistencies (e.g. utilization of invalid cached data, unreleasing of shared resources) that can introduce faults in the system.
This project consisted of two objectives: the first was to somehow classify the occurrences of stale references so we could diagnose and point out the reality of this problem in OSGi-based applications; and the second was to envision solutions to make such applications more robust to isolation issues. This report presents two independent but complementary solutions developed using Aspect Oriented Programming techniques, addressing such isolation limitations in OSGi: the first implementation is a diagnostics tool called Service Coroner which provides runtime detection of stale references and has shown the reality of that problem by diagnosing four large OSGi applications: JOnAS, Sling, SIP Communicator, Newton; the second implementation is a fail-stop services mechanism to avoid the usage of unregistered services minimizing OSGi isolation limitations, which had its efficiency benchmarked against other OSGi service approaches.