Upload
erik-cooper
View
213
Download
0
Embed Size (px)
Citation preview
Wednesday 29th of October 20141
Incinerator
Koutheir ATTOUCHI1,2, Gaël THOMAS1, André BOTTARO2, Gilles MULLER1
1 Laboratoire d’Informatique de Paris 6, France.2 Orange Labs, Grenoble, France.
Detecting & ResolvingStale Referencesin Java
Wednesday 29th of October 20142
The Smart HomeMultiple Application Domains
Security
Energy
Healthcare
Comfort
Well being
Multimedia
Content sharing
Games
Wednesday 29th of October 20143
The Smart HomeConnected devices
Devices are Connected Easy to install Affordable
Fridge Thermostat Fork Oven etc.
Connected devices Toothbrush Washing machine Scale Locks Dishwasher
Wednesday 29th of October 20144
Home Automation GatewayOffered by a Smart Home Operator
One common embedded platform Hosting applications delivered by various tiers1
1 Condry et al. (IECON’99); Royon and Frénot (2007)
Objectives Reduce service
deployment costs
Share connected devices between tiers
Wednesday 29th of October 20145
HypothesisUnreliable and long-running applications
Applications can be– Buggy– Malicious
The platform runs for long duration
Abrupt restarts of the platform can be dangerous for– Devices– Inhabitants
Wednesday 29th of October 20146
Addressed Issues
Resolve stale references in Java applications
Stale reference A reference to a stale object: an object that became
unusable– Many objects become unusable after updates and
uninstallation of applications
O1Object in App1 Object in App2O2
Reference
Stale ReferenceO2
App2 uninstalled O2 stale
Wednesday 29th of October 20147
Smart Home Alarm ApplicationMotivation by an example
Alarm Application
GasSensor DriverSiren Driver
1.0
Siren Configuration(Format: Simple Text)
Gas SensorAlarm Siren
Siren Configuration(Format: XML)
StaleReference
Siren Driver 2.0
3
1
21
2
3
Update Siren Driver version 2.0
Convert Siren configuration format XML
Forget to update the reference to Siren Driver 1.0
1
3
2
1
3
2
Memory leak
Data corruption
Physical hazard
Wednesday 29th of October 20148
Significant Memory LeakCaused by Stale References1
O1
1 Lindholm and Yellin (1999); Johnson and Dawson (2014)
S
C2 C4
C3Class(S)
ClassLoader(S)
Stale reference
Stale object
Wednesday 29th of October 20149
Significant Memory LeakCaused by Stale References
Memory leaks caused by stale references appearing after multiple updates of a buggy application
Wednesday 29th of October 201410
IncineratorApproach
Detect and eliminate* stale references
Incinerator transforms stale references to null references during garbage collection cycle
* The Devil is in the Details…
Incinerator
O1
O2
S2
O3
S1
O4
Stale reference Stale object
Wednesday 29th of October 201411
Cleaning up resourcesin Object.finalize()
Objective: Allow objects to cleanup
their resources– Execute Object.finalize()
without risking exceptions due to stale references
Incinerator allows unreachable finalizable objects to hold stale references– Defer stale references
elimination to the following garbage collection cycle
Incinerator
O3
S1
O4
Stale reference Stale object
F1
Defer
Unreachable finalizable object
Wednesday 29th of October 201412
Synchronization Issueswhen Eliminating Stale References
Incinerator
T1 T2 T3
S1
T1, T2 and T3 synchronize on the monitor of S1
Stale reference Stale object Active thread Blocked thread
T3 and T2 blocked forever
Wednesday 29th of October 201413
Synchronization Handlingwhen Eliminating Stale References
T1 T2 T3
S1
Stale reference Stale object Active thread Blocked thread
Incinerator
Wake up!
Monitor(S1) StaleMonitor(S1) = Stale
!NPE
!NPE
Wake up!!NPE
Wednesday 29th of October 201414
Implementation
1000 lines of C++ in the J3/VMKit1 JVM
Tested on Knopflerfish2, an open source recognized implementation of OSGi– 10 lines added to Knopflerfish
Independent of the garbage collector algorithm
Open source– http://llvm.org/svn/llvm-project/vmkit/branches/incinerator/
1 Geoffray et al. (VEE’10)2 Makewave AB Corp. (2014)
Wednesday 29th of October 201415
Functional EvaluationMicro benchmarks
10 scenarios of stale references, divided by:– Visibility from the OSGi framework– Scope of stale references– Synchronization on stale references– Finalization of objects holding stale references
Stale references detection results
Scenario 1 2 3 4 5 6 7 8 9 10
J3/Hotspot
Service Coroner1
Incinerator
Incinerator also eliminates all detected stale references
1 Gama and Donsez (SEAA’08)
Wednesday 29th of October 201416
Performance EvaluationDaCapo1 benchmark suite
Low-end computer High-end computer
Average cost in execution time of DaCapo test suites on J3 and on Incinerator
Execution cost < 4%1 Blackburn et al. (OOPSLA’06)
Wednesday 29th of October 201417
Conclusion
Incinerator Incinerator detects and eliminates stale references,
avoiding:– Memory leaks– Data corruption– Physical hazards
And makes stale references visible to Java/OSGi developers
Execution cost < 4% Tolerable in:– Constrained production environments– Test environments
Implementation is mostly independent of:– The OSGi framework implementation– The garbage collection algorithm Thank you!