OH4 - Unable to shutdown on Windows 10 (Service or start.bat

Hi All

I have discovered a weird issue with my openHAB setup on a Windows 10 device (yes, I know…).

I have upgraded to OH 4.0.0.M2, though started between OH 4.0.0.M1 and now .

Either when running as a service, or from start.bat, when trying to shut down openHAB the processes just carry on running i a limited way and requires a reboot to recover.

The service eventually give an error:
image

13:48:04.563 [INFO ] [.io.openhabcloud.internal.CloudClient] - Shutting down openHAB Cloud service connection
13:48:04.566 [WARN ] [.io.openhabcloud.internal.CloudClient] - Socket.IO disconnected: io client disconnect
13:48:04.567 [INFO ] [.io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = 66...09, base URL = http://localhost:8080)
13:48:07.433 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler ShellyRelayHandler tried updating the thing status although the handler was already disposed.
13:48:12.018 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler ShellyRelayHandler tried updating the thing status although the handler was already disposed.
13:48:13.018 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler ShellyRelayHandler tried updating the thing status although the handler was already disposed.
13:48:13.027 [INFO ] [e.influxdb.InfluxDBPersistenceService] - InfluxDB persistence service stopped.
13:48:13.600 [WARN ] [org.eclipse.jetty.io.ManagedSelector ] - java.nio.channels.ClosedSelectorException

The WARN 13:48:13.600 [WARN ] [org.eclipse.jetty.io.ManagedSelector ] - java.nio.channels.ClosedSelectorException seems to be what is different from a working system that I have tested on Windows 11.

I have also tested a “clean” install and do not get this issue, but that said I do not see the issue on Windows 11 either.

Using start.bat gives:
image

So nothing after logout until batch file terminated

14:05:50.211 [INFO ] [.io.openhabcloud.internal.CloudClient] - Shutting down openHAB Cloud service connection
14:05:50.259 [WARN ] [.io.openhabcloud.internal.CloudClient] - Socket.IO disconnected: io client disconnect
14:05:50.291 [INFO ] [.io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = 66...09, base URL = http://localhost:8080)
14:05:54.315 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler ShellyRelayHandler tried updating the thing status although the handler was already disposed.
14:05:55.021 [INFO ] [e.influxdb.InfluxDBPersistenceService] - InfluxDB persistence service stopped.
14:05:55.279 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler ShellyRelayHandler tried updating the thing status although the handler was already disposed.
14:05:55.348 [WARN ] [org.eclipse.jetty.io.ManagedSelector ] - java.nio.channels.ClosedSelectorException
14:05:57.277 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler ShellyRelayHandler tried updating the thing status although the handler was already disposed.

Any idea how I can try work out what in my config is causing the issue shutting down openHAB?

EDIT:
This appears to be a “normal” shutdown?

14:48:06.678 [INFO ] [.io.openhabcloud.internal.CloudClient] - Shutting down openHAB Cloud service connection
14:48:14.446 [INFO ] [e.influxdb.InfluxDBPersistenceService] - InfluxDB persistence service stopped.
14:48:21.916 [WARN ] [.service.spi.util.WebContainerManager] - Can't get a WebContainer service from {org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer}={org.ops4j.pax.web.log.ncsa.extended=true, org.ops4j.pax.web.ssl.keystore.password=********, service.scope=bundle, org.ops4j.pax.web.ssl.key.password=********, org.ops4j.pax.web.session.cookie.name=JSESSIONID, org.osgi.service.http.connector.name=default, org.ops4j.pax.web.enc.iterationcount=1000, org.ops4j.pax.web.log.ncsa.file=yyyy_mm_dd.request.log, org.ops4j.pax.web.server.eventDispatcherThreadCount=1, org.osgi.service.http.checkForwardedHeaders=false, org.ops4j.pax.web.enc.suffix=), org.ops4j.pax.web.digestAuth.maxNonceAge=60000, org.ops4j.pax.web.ssl.ciphersuites.included=, org.ops4j.pax.web.session.url=jsessionid, org.ops4j.pax.web.formAuth.errorRedirect=false, org.ops4j.pax.web.ssl.ciphersuites.excluded=^.*_(MD5|SHA|SHA1)$,^TLS_RSA_.*$,^SSL_.*$,^.*_NULL_.*$,^.*_anon_.*, org.ops4j.pax.web.enc.prefix=ENC(, org.ops4j.pax.web.server.maxThreads=50, org.ops4j.pax.web.validatePeerCerts=false, service.id=152, org.ops4j.pax.web.session.cookie.maxAge=-1, org.ops4j.pax.web.ssl.truststore.password=********, org.ops4j.pax.web.ssl.session.cacheSize=-1, org.ops4j.pax.web.ssl.truststore.type=JKS, org.ops4j.pax.web.ssl.keystore.type=JKS, org.ops4j.pax.web.ssl.session.enabled=true, org.ops4j.pax.web.ssl.protocol=TLSv1.3, org.osgi.service.http.port=8080, org.ops4j.pax.web.log.ncsa.file.date.format=yyyy-MM-dd, org.ops4j.pax.web.ssl.renegotiationLimit=-1, org.osgi.service.http.secure.enabled=true, org.osgi.service.http.enabled=true, org.ops4j.pax.web.server.idleTimeout=300000, org.ops4j.pax.web.log.ncsa.retaindays=90, org.ops4j.pax.web.log.ncsa.logtimezone=GMT, org.ops4j.pax.web.enc.algorithm=PBEWithHmacSHA256AndAES_128, org.ops4j.pax.web.validateCerts=false, org.ops4j.pax.web.config.files=C:\openHAB\runtime\etc\jetty.xml, org.ops4j.pax.web.ssl.renegotiationAllowed=true, org.ops4j.pax.web.digestAuth.maxNonceCount=1024, org.ops4j.pax.web.enableOCSP=false, org.ops4j.pax.web.ssl.clientauth.needed=false, org.ops4j.pax.web.enc.enabled=false, org.osgi.service.http.port.secure=8443, javax.servlet.context.tempdir=C:\Windows\system32\config\systemprofile\AppData\Local\Temp, org.ops4j.pax.web.enableCRLDP=false, org.ops4j.pax.web.server.connector.idleTimeout=30000, org.ops4j.pax.web.session.timeout=10, org.ops4j.pax.web.ssl.clientauth.wanted=false, org.ops4j.pax.web.ssl.protocols.excluded=SSL,SSLv2,SSLv2Hello,SSLv3, service.bundleid=224, org.ops4j.pax.web.server.minThreads=2, org.ops4j.pax.web.session.cookie.secure=false, org.ops4j.pax.web.enc.masterpassword=********, org.ops4j.pax.web.log.ncsa.append=true, org.osgi.service.http.secure.connector.name=secureDefault, org.ops4j.pax.web.ssl.session.timeout=-1, org.ops4j.pax.web.listening.addresses=0.0.0.0, org.ops4j.pax.web.log.ncsa.buffered=true, org.ops4j.pax.web.session.cookie.sameSite=unset, org.ops4j.pax.web.log.ncsa.enabled=false, org.ops4j.pax.web.ssl.protocols.included=, org.ops4j.pax.web.session.cookie.httpOnly=true, org.ops4j.pax.web.server.showStacks=false}

Have you fired up systernals procmon to see what windows handle is hanging?
based on what you are stating a clean install works ok or a win 11 install is fine It likely in your openhab instance and one or more of the bindings are struggling to unload correctly. Perhaps it is hanging on releasing a I/O resource.
I would start with procmon and begin removing or disabling bindings and features till winders gets happy again.
BTW I could not repo it on my win 10 instance and I even ran the bat file to and passed it with the stop arg to the runtime and it all seemed to behave correctly. It did however seem to take a bit longer then doing ctrl D or logout from Karaf console but it cleanly shut down each time.

I just thought I would post an update.

I was not able to work out what the cause of this issue was, however I rebuilt the machine (clean install) and copied my openHAB folder across and all is working now.