ggirard07 created KARAF-6792:
--------------------------------
Summary: Memory leak when restarting bundle with service bound to
a command
Key: KARAF-6792
URL: https://issues.apache.org/jira/browse/KARAF-6792
Project: Karaf
Issue Type: Bug
Components: karaf
Affects Versions: 4.2.8
Environment: Karaf 4.2.8
openjdk 11.0.7 2020-04-14
Reporter: ggirard07
Code to reproduce the issue available atÂ
[https://github.com/ggirard07/karaf-command-service-leak]
When restarting a bundle containing a command with a bound service with
@Reference annotation, the previous service instance is being leaked because
the command instance keep the object alive.
Trying to reproduce the issue might take multiple restarts as the reproduction
sample seems to be leaking at a frequency of 2/3 based on my testing.
*Steps to reproduce*
# Install the bundle built from reproduction sample
# Inspect MyServiceImpl instances in VisualVM
# Restart the bundle with bundle:restart bundleId
# Inspect MyServiceImpl instances in VisualVM
*Expected result*
A single instance of the MyServiceImpl singleton exist at all time.
*Actual result*
The old MyServiceImpl instance is leaked and 2 instances of the service
singleton coexists.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)