[CONTROLLER-611] Module method close() not invoked on uninstall or stop. Created: 07/Jul/14  Updated: 25/Jul/23  Resolved: 05/Jul/17

Status: Resolved
Project: controller
Component/s: config
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Ken Jarrad Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: PC


Issue Links:
Duplicate
is duplicated by TSDR-9 TSDR inventory and poller thread are ... Resolved
External issue ID: 1322
Priority: Normal

 Description   

There is a method in the Java code generated from Yang:

public abstract java.lang.AutoCloseable createInstance();

I implement createInstance() to return an instance of AutoClose with a close() method that closes all my socket connections. There is also a log statement in the close() method. Naturally I want to check that the close() method executes. I want to see the log output.

If I shutdown Equinox then close() is invoked but not if I uninstall or stop the bundle. Note that a shutdown after uninstall or stop does invoke close().



 Comments   
Comment by Abhishek Kumar [ 15/Apr/15 ]

UP'ed the the severity. This blocks a karaf feature redeployment.

Steps to reproduce:

1. Create an MD-SAL based feature
2. Deploy the feature kar file by copying to deploy folder
3. At karaf console, ensure that the feature got installed
4. Delete the feature kar file from deploy folder
5. At karaf console, ensure that the feature got uninstalled
6. Build a new version of the feature
7. Copy the new version of feature into the deploy folder
8. At karaf console, ensure that the feature got installed
9. Even though karaf says that the feature got installed, Config subsystem would complain while installing.

In JConsole, if you check the list of modules installed by Config subsystem, your newly installed module will be absent.

While debugging, following is my observation:

  • On feature uninstall, config system gets a notification from OSGI container about bundle uninstall. Config subsystem creates a blank transaction that is supposed to reconfigure existing modules. Config manager, who's supposed to process this transaction, fails to check if the bundle, where the module its configuring came from, is in ACTIVE state or not. If it reconfigures the modules only from ACTIVE bundles, and destroys/closes the ones not in ACTIVE state, feature/bundle uninstall should work fine.
  • Even with above fix in my local environment, feature re-install didnt work for me. While feature uninstall went fine, when I tried to install a new version of the feature, it didnt get installed. Karaf shows that my feature got installed but JConsole doesnt show the module in config-subsystem. Also, createInstance() of my module didnt get called. My log messages didnt get printed. Looks like there's some lingering cache in netconf-connector that thinks this module already exists even though it was uninstalled.
Comment by Tony Tkacik [ 15/Apr/15 ]

This would require additional design and interactions such as deconfiguring your feature on uninstall (since your configuration was applied) which would probably require behaviour change / API change.

I am not sure if this is doable in Lithium and or stable/helium

Comment by Tom Pantelis [ 05/Jul/17 ]

The CSS is being deprecated so not worth addressing. Blueprint provides the desired behavior.

Generated at Wed Feb 07 19:53:27 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.