Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

xray provider sometimes throws on framework exit #76

Closed
eliasvasylenko opened this issue Jan 4, 2017 · 2 comments
Closed

xray provider sometimes throws on framework exit #76

eliasvasylenko opened this issue Jan 4, 2017 · 2 comments

Comments

@eliasvasylenko
Copy link
Contributor

Sometimes when the osgi.enroute.webconsole.xray.provider listener hook is called back for removal the bundle context is no longer valid by the time it is processed, resulting in the following exception:

[ERROR  ; osgi.enroute.webconsole.xray.provider_2.0.0.201610141745 [126]] FrameworkEvent ERROR

!ENTRY osgi.enroute.webconsole.xray.provider 4 0 2017-01-04 14:32:56.645
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.ServiceException: Exception in osgi.enroute.webconsole.xray.provider.XRayWebPlugin$1.removed()
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1288)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1263)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyListenerHooksPrivileged(ServiceRegistry.java:1378)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyListenerHooks(ServiceRegistry.java:1360)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.removeAllServiceListeners(ServiceRegistry.java:780)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.close(BundleContextImpl.java:92)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:948)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:314)
	at org.eclipse.osgi.container.Module.doStop(Module.java:636)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1580)
	at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147)
	at org.eclipse.osgi.container.Module.doStop(Module.java:636)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: BundleContext is no longer valid
	at org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:984)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.getBundle(BundleContextImpl.java:129)
	at osgi.enroute.webconsole.xray.provider.XRayWebPlugin.removeListenerInfo(XRayWebPlugin.java:756)
	at osgi.enroute.webconsole.xray.provider.XRayWebPlugin.access$200(XRayWebPlugin.java:81)
	at osgi.enroute.webconsole.xray.provider.XRayWebPlugin$1.removed(XRayWebPlugin.java:124)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry$10.call(ServiceRegistry.java:1384)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1280)
	... 18 more

I assume this is safe to ignore (other than possibly the hanging entries in the listeners map?) but in that case at the very least there is no need to spam the log with these messages.

Would anyone object if I made a PR to deal with this?

@eliasvasylenko eliasvasylenko changed the title Log spammed with errors on framework exit xray provider sometimes throws on framework exit Jan 4, 2017
@pkriens
Copy link
Member

pkriens commented Jan 4, 2017 via email

eliasvasylenko pushed a commit to eliasvasylenko/osgi.enroute.bundles that referenced this issue Jan 5, 2017
Maintain a mapping to BundleContexts instead of Bundles to avoid the
issue of them becoming invalid.

Signed-off-by: Elias N Vasylenko <[email protected]>
eliasvasylenko pushed a commit to eliasvasylenko/osgi.enroute.bundles that referenced this issue Jan 5, 2017
Maintain a mapping to BundleContexts instead of Bundles to avoid the
issue of them becoming invalid.

Signed-off-by: Elias N Vasylenko <[email protected]>
@eliasvasylenko
Copy link
Contributor Author

Does anyone check these? Is the PR no good?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants