openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

[smaenergymeter] IllegalStateException #17631

Open lsiepel opened 1 month ago

lsiepel commented 1 month ago
          I'm getting the exact same error with 4.3.0M2, isn't this fix supposed to be in there ?

The SHM thing is stuck in 'unknown' state and a bundle restart results in the log below.

FWIW, scanning does not find any SHM, and on manual thing creation I cannot add any serial Number. But that OH complains about as being mandatory. Created via .thing for now. (sidenote question: is that a decimal value as printed on the device or some other format such as hex ?)

2024-10-07 22:17:09.230 [DEBUG] [f.shell.impl.console.osgi.LoggingCommandSessionListener] - Executing command: 'bundle:restart org.openhab.binding.smaenergymeter'
2024-10-07 22:17:09.241 [DEBUG] [org.apache.karaf.shell.impl.action.osgi.CommandExtender] - org.openhab.binding.smaenergymeter (271): Starting destruction process
2024-10-07 22:17:09.243 [DEBUG] [org.apache.karaf.shell.impl.action.osgi.CommandExtender] - org.openhab.binding.smaenergymeter (271): Not an extended bundle or destruction of extension already finished
2024-10-07 22:17:09.244 [DEBUG] [org.apache.karaf.shell.impl.action.osgi.CommandExtender] - org.openhab.binding.smaenergymeter (271): Starting destruction process
2024-10-07 22:17:09.246 [DEBUG] [org.apache.karaf.shell.impl.action.osgi.CommandExtender] - org.openhab.binding.smaenergymeter (271): Not an extended bundle or destruction of extension already finished
2024-10-07 22:17:09.274 [WARN ] [n.ThreadPoolManager$UnstoppableScheduledExecutorService] - shutdownNow() invoked on a shared thread pool 'OH-binding-smaenergymeter-listener'. This is a bug, please submit a bug report
java.lang.IllegalStateException: null
        at org.openhab.core.common.ThreadPoolManager$UnstoppableExecutorService.shutdownNow(ThreadPoolManager.java:242) ~[?:?]
        at org.openhab.binding.smaenergymeter.internal.packet.DefaultPacketListenerRegistry.shutdown(DefaultPacketListenerRegistry.java:68) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:245) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:687) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:531) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) ~[?:?]
        at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) ~[?:?]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.disposeImplementationObject(SingleComponentManager.java:421) ~[?:?]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.deleteComponent(SingleComponentManager.java:165) ~[?:?]
        at org.apache.felix.scr.impl.manager.SingleComponentManager.ungetService(SingleComponentManager.java:1043) ~[?:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$2.run(ServiceFactoryUse.java:273) ~[org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$2.run(ServiceFactoryUse.java:1) ~[org.eclipse.osgi-3.18.0.jar:?]
        at java.security.AccessController.doPrivileged(AccessController.java:318) [?:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryUngetService(ServiceFactoryUse.java:270) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.ungetService(ServiceFactoryUse.java:167) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.ungetService(ServiceConsumer.java:53) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.ungetService(ServiceRegistrationImpl.java:632) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.ungetService(ServiceRegistry.java:613) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.ungetService(BundleContextImpl.java:703) [org.eclipse.osgi-3.18.0.jar:?]
        at org.apache.felix.scr.impl.manager.SingleRefPair.safeUngetService(SingleRefPair.java:109) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.SingleRefPair.ungetServiceObjects(SingleRefPair.java:74) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager$AbstractCustomizer.ungetService(DependencyManager.java:231) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.close(DependencyManager.java:1426) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.DependencyManager.deactivate(DependencyManager.java:1568) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateDependencyManagers(AbstractComponentManager.java:1280) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.doDeactivate(AbstractComponentManager.java:854) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:825) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:589) [bundleFile:?]
        at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.disposeComponents(ConfigurableComponentHolder.java:722) [bundleFile:?]
        at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:492) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:652) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator.access$300(Activator.java:74) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator$ScrExtension.destroy(Activator.java:490) [bundleFile:?]
        at org.apache.felix.scr.impl.AbstractExtender$1.run(AbstractExtender.java:216) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at org.apache.felix.scr.impl.AbstractExtender.destroyExtension(AbstractExtender.java:238) [bundleFile:?]
        at org.apache.felix.scr.impl.AbstractExtender.bundleChanged(AbstractExtender.java:132) [bundleFile:?]
        at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:255) [bundleFile:?]
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:949) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:229) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:138) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:130) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:217) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.Module.publishEvent(Module.java:499) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.Module.doStop(Module.java:658) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.container.Module.stop(Module.java:521) [org.eclipse.osgi-3.18.0.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.stop(EquinoxBundle.java:472) [org.eclipse.osgi-3.18.0.jar:?]
        at org.apache.karaf.bundle.command.Restart.doExecute(Restart.java:44) [bundleFile:?]
        at org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:55) [bundleFile:?]
        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:88) [bundleFile:4.4.6]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [bundleFile:4.4.6]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [bundleFile:4.4.6]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [bundleFile:4.4.6]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [bundleFile:4.4.6]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [bundleFile:4.4.6]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [bundleFile:4.4.6]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [bundleFile:4.4.6]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [bundleFile:4.4.6]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]

Originally posted by @mstormi in https://github.com/openhab/openhab-addons/issues/17280#issuecomment-2397819780

lsiepel commented 1 month ago

@mstormi created this new issue to keep track. Reading your comment it seems there are already issues before the log entry (that happens at bundle restart) so maybe you can guide me step by step to see what is and what is not working to this binding. Hopefully with some debug logs to show what is going on within the binding.