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.