Cannot stop deconz via systemctl

Hey,

I am using deconz in a Debian VM (Debian 11).
Now recently I updated deconz and everything else to latest version (2.31.2).

It currently works well after a VM restart.
But if I want to stop it via
sudo systemctl stop deconz
the command takes a very long time. During that time, systemctl status deconz shows:
Active: deactivating (stop-sigterm) since … (30–50s)
CPU usage stays very low (around 2–5%), so the process does not seem busy.
After ~30 seconds, the service fails with a timeout:
Active: failed (Result: timeout)

The journalctl then shows:

systemd[1]: Stopping deCONZ: ZigBee gateway -- REST API...
systemd[1]: deconz.service: State 'stop-sigterm' timed out. Killing.
systemd[1]: deconz.service: Killing process XXXX (deCONZ) with signal SIGKILL.
systemd[1]: deconz.service: Main process exited, code=killed, status=9/KILL
systemd[1]: deconz.service: Failed with result 'timeout'.

If I then try to start it again, it hangs. :confused:

My service looks like this:

### /etc/systemd/system/deconz.service
[Unit]
Description=deCONZ: ZigBee gateway -- REST API
Wants=deconz-init.service deconz-update.service
StartLimitIntervalSec=0

[Service]
User=1000
ExecStart=/usr/bin/deCONZ -platform minimal --http-port=80 --dev=/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_Co>
Restart=on-failure
RestartSec=30
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME

[Install]
WantedBy=multi-user.target

Any suggestions what could be the reason?

EDIT:
Further investigations:

Is it correct that this is always running in the background?
root 398 0.0 0.3 7028 3108 ? Ss 11:50 0:04 /bin/bash /usr/bin/deCONZ-update2.sh

On my side, on classic OS (Raspbian)
If I close it, have the same issue, and not possible to restart it because of deconz-autostart.sh

#check if deCONZ already running
pidof deCONZ
if [ $? -eq "0" ]; then
    echo "deCONZ already running"
    exit 1
fi

To restart deconz I need to make

pi@raspberrypi:~ $ pidof deCONZ
16830
pi@raspberrypi:~ $ sudo pkill 16830
1 Like

Interesting. :slight_smile: So I am not alone.
Did you consider, adding some lines to the service telling it to use your kill method for shutdown? That was AIs suggestion for me, but it certainly is a workaround for a bug that only the devs can fix, right?

Yes, the problem is direclty in the deconz application for me, the application hang at close, but it something recent, and probably already corrected.
The version 2.31.2 have (critic for me) some issues, already patched, but for the moment I m waiting the 2.31.3 to make test.

I don’t restart deconz often, for the moment I type the shell commands myself, I don’t use workaround yet.

1 Like

Oh ok, so you can confirm that this is indeed a bug in deconz? Was it noted in GitHub or how do you know? Because then I’d also leave it as is. I also restart it very rarely - and if I need to, I can still quickly restart my whole VM. I just wanted to know if I have a messed up config. :smiley:
But if you have a GitHub issue or something, I could follow that to see, when an update for me is due to fix this. :slight_smile:

ha no ^^, I have just see the issue too, I have say it on dev channel on discord, I had no reaction.

For me better to wait for next version first to see if the issue is still here, there is already some patchs planned.

Strange we are only 2 with this issue (or few users try to restart deconz), it’s nice you have started something, to have more return, and dev reads the forum too.

1 Like

This fix:

was integrated in 2.32.3 Beta on 15th of January.
Maybe that fixes it, but the versions are all still beta.

The v2.32.4-beta is out, I will make a try today.

I m on version v2.32.4-beta ATM.
I can’t say if it’s better, I have tried to close it and reopen it fastly, I need 4s max delay (On raspberry 3), and it works.
But before installing the new version, have made a try on the previous version, and it have worked too, so the issue can be random.

1 Like

Nice, but that sounds promising. Do you actively choose the beta upgrade path? Because if so, I will probably just wait until 2.32.2 is released in the stable branch.

On my side I just download the package and install it.
But yes, with all issues we had with previous version, lot of chance to have a stable version soon, for the moment no bad return with v2.32.4-beta.

1 Like

Ok so the issue is still here
Not possible to kill deconz, and my previous command is not working, the only way I have found is

pgrep -io deconz | xargs kill -KILL