openHAB server seems to go to "sleep" after a few minutes

Hello everyone

First of all, sorry if this has been answered before (I feel it might have), I searched but couldn’t find anything.

I recently moved my openHAB installation away from my Pi and onto a proper PC, in order to increase speed. And indeed I have, navigating the interface is now a whole lot faster!

However, I have this problem: When using PaperUI, navigating back and forth between different pages (e.g. between Control and Inbox) is really fast, almost instant. However, when I stop using it for a few minutes (just 2-3 minutes, not a lot) then on my next click there is a big delay of maybe 5-6 seconds.

This is very annoying, as almost every time I pick up my phone to open Control and do something (e.g. lowering the music volume) I have to wait for 5-6 seconds before I get the controls.

Any ideas about why this might be happening? The server uses an SSD so I don’t think this could related to “spindown” or something similar.

P.S.This is not specific to PaperUI. I’ve almost finished building a custom interface (using the API) and the same thing happens there. When I send a command (e.g. turn a device on) it happens instantly. But if I leave it for a few minutes and then click on the same button, the action take 5-6 seconds to be applied.

Thanks very much in advance.

What OS are you using?

It’s an OpenMediaVault server, which is basically Debian Stretch.

Don’t forget PaperUI is an administrator’s interface. It is not intended as your day to day user interface, there are several options provided for that purpose.

To be honest it sounds like something in your phone times out.

How does it go from a browser on the PC itself ?

You should not be using this interface to interact with your items
You should be using BasicUI or HABPanel and the relevant app on your phone

1 Like

Thanks guys, but this is why I mentioned that it also happens when I use my own interface, which uses the openhab API. So it’s not just PaperUI. I also just tried through HABPanel just to make sure, same thing.

Also, it’s exactly the same behavior from my laptop’s browser, not just the phone.

I did some further testing. When I click on a button, I see in the browser’s network tab that the request is sent immediately. So it’s not a matter of a “dead” tab in the browser. Also, at the same time I’m looking at the server’s connections running netstat and I’m seeing that the request also arrives immediately.

However, what happens then is that the connection remains in a SYN_RECV state for a while before it turns to ESTABLISHED (which then also triggers the action).

And this also made me remember I had done the same debugging process when openHAB was running on the Pi, because I was also dealing with the same problem at some point.

So it’s not machine specific, but if no one else has this problem, it is specific to my setup. So maybe it’s a network problem? I don’t know if that could be true since the connection arrives at the server without delay. Otherwise it could be a configuration/setup thing, but I’m not seeing any errors or warning in my logs. And why would this only happen after a period of inactivity and not every time?

I know there’s a very slim chance of anyone having the same problem as me, but since I found the solution, I’m going to post it for posterity’s sake.

Turns out the problem was with my MikroTik router. I wanted to give my servers (openHAB, NAS etc.) static IPs so they would be more convenient to handle. So, in the router’s config I had limited the DHCP pool to IPs 2-62 (/26 mask) and was giving static IPs that were above 62.

However, instead of just limiting the pool, I had also limited the “network” configuration of the DHCP server. As a result, the subnet the clients were getting was with a /26 mask as well, and therefore when I had them hit a static IP, they considered this IP to be outside their network and therefore sent the request to the router instead of the server directly. This led to communication delays and a lot of retries, until the connection was finally established after a few seconds.

Thanks very much for the help!