Delay when connecting to openHAB via SSH/curl etc. on Windows 11

Since upgrading my laptop to Window 11 connecting to openHABian via ssh and rest API calls made via curl on the command line appear to hang for ~20s before being actioned. Prior to upgrade it was instantaneous.

For example, if I start the connection using puTTy, the console window is blank for 20s and then starts working, after that the connection works as expected. The same is true if I run a curl command from the command line. I tried investigating the delay using -v --trace, but this showed nothing for 20s, then the actual request is done in a few milliseconds. It seems to be hanging before attempting to connect to openHAB. Here’s the output:

C:\Users\martii>curl -v --trace-time --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://openhabian:8080/rest/items/d_lamp1T"
09:08:29.466000 *   Trying 192.168.1.221:8080...
09:08:29.470120 * Connected to openhabian (192.168.1.221) port 8080 (#0)
09:08:29.471818 > POST /rest/items/d_lamp1T HTTP/1.1
09:08:29.471818 > Host: openhabian:8080
09:08:29.471818 > User-Agent: curl/7.83.1
09:08:29.471818 > Content-Type: text/plain
09:08:29.471818 > Accept: application/json
09:08:29.471818 > Content-Length: 2
09:08:29.471818 >
09:08:29.481454 * Mark bundle as not supporting multiuse
09:08:29.483686 < HTTP/1.1 200 OK
09:08:29.485051 < Content-Type: text/plain
09:08:29.486951 < Date: Wed, 22 Mar 2023 09:08:29 GMT
09:08:29.488690 < Content-Length: 0
09:08:29.490008 < Server: Jetty(9.4.46.v20220331)
09:08:29.491636 <
09:08:29.492624 * Connection #0 to host openhabian left intact

Has anyone else experienced this kind of issue?

Thanks,
Alex

My setup

  • Hardware: Raspberry Pi 4B 4gb
  • OS: openHABian 5.10.103-v7l+ #1529
  • Java Runtime Environment: JDK11
  • openHAB version: 3.3.0

Check for flapping interface: dmesg

I wonder if this is caused by (reverse… or maybe even forward) dns lookup

to check if it’s forward lookup causing the delay, try using ip address instead of hostname (openhab?)

In windows environment I am always suspecting that it is an antivirus / firewall related problem.

Thanks all for your comments and suggestions. @JimT you nailed it; using the IP address instead of hostname brought back instantaneous functionality.

I could just start using that but I have quite a few scripts and settings to wade through so would prefer to find the root cause of the DNS lookup delay. Any idea of what might cause this?

This all started happening when I upgrade form Win 10 to 11, but I can’t see any other reports of this DNS issues related to the new operating system.

Is mdns locked down in windows firewall?

Yep, that did it! I made a firewall exception on port 53 for DNS lookup and now everything is working instantly again. Thanks for your help.

It’s been a while since I posted but actually the problem has returned. It may have been a fluke that it connected faster last time. I’ve now tried opening ports 22, 8080 and 53 :slightly_frowning_face:

Not only is there a 30s delay before the SSH client connects, but the same delay is seen when connecting to samba shares in Windows Explorer. Even going to openHAB in a browser (openhabian:8080) waits 30s before connecting. My Windows 10 PC on the same network does all these things instantly. Both are connected via ethernet.

Any ideas what might be causing it?

Is it only SSH that’s slow, or also HTTP on port 8080?

Have you tried disabling the firewall on both the openhabian and the windows computer to see if they have something to do with it?

Yes, it has the same delay when using HTTP on port 8080.

It’s a work laptop so I can’t get too deep into firewall settings. I believe it’s manage by Sophos Intercept X. I can change Windows Firewall settings, but Sophos probably has its own.

The odd thing is that I had the same security installed on Windows 10 and it was the switch to 11 that caused the issue.

I can’t explain about the delay on HTTP / port 8080. How about trying it from a phone, to rule out the openhab/openhabian side of things.

Yep, it connects instantly on my phone when going to http://openhabian:8080.

So the problem lies on the Windows client.

  • Is it DNS, i.e. is http://192.168.x.x:8080 also slow?
  • Is it the fact that it’s a non standard port? Try changing openhab to port 80

Using the IP address is instantaneous. I guess the security software is blocking MDNS?

mdns would be http://openhabian.local:8080

I’m not too familiar with openhabian and what it does to make http://openhabian:8080 resolvable - does it inject that into the local DNS server, where does that exist, and is it configured for DDNS? Is your Windows using that same local dns server for name resolution? Or perhaps Windows appends the .local to the dns lookups when lookup for just a plain openhabian failed, and that might explain the delay

It looked like it worked but actually I think the connection was just still open. Still the same delay.

It would be interesting the know if others have experienced that same thing.