Excessive TCP connections

Hi all,

Haven’t been able to find any solution to this issue - hope someone can help.

Using Debian 12
Since I have updated to Deconz 2.32.1 TCP connections that are opened by deconz continues to rise until the service stops responding with 100% CPU and max open files is reached.

sudo lsof -p 637 | grep -i ipv4 | wc -l

Shows currently 693, this is with 6:39h system uptime, and the number of connections continues to rise.

COMMAND PID  USER   FD      TYPE             DEVICE SIZE/OFF     NODE NAME
deCONZ  637 jakob   17u     IPv4             209844      0t0      TCP localhost:60864->localhost:8001 (ESTABLISHED)
deCONZ  637 jakob   18u     IPv4             212351      0t0      TCP localhost:8001->localhost:60864 (ESTABLISHED)
deCONZ  637 jakob   19u     IPv4             562022      0t0      TCP localhost:56350->localhost:8001 (ESTABLISHED)
deCONZ  637 jakob   20u     IPv4             562193      0t0      TCP localhost:8001->localhost:56350 (ESTABLISHED)
deCONZ  637 jakob   21u     IPv4             614257      0t0      TCP localhost:34040->localhost:8001 (ESTABLISHED)
deCONZ  637 jakob   22u     IPv4             617172      0t0      TCP localhost:8001->localhost:34040 (ESTABLISHED)
deCONZ  637 jakob   23u     IPv4             680347      0t0      TCP localhost:43038->localhost:8001 (ESTABLISHED)
deCONZ  637 jakob   24u     IPv4             614259      0t0      TCP localhost:34054->localhost:8001 (ESTABLISHED)
deCONZ  637 jakob   25u     IPv4             617174      0t0      TCP localhost:8001->localhost:34054 (ESTABLISHED)
deCONZ  637 jakob   26u     IPv4             683093      0t0      TCP localhost:8001->localhost:43038 (ESTABLISHED)

Deconz journalctl log:

-- Boot 176c8888b4f943979ad35a613179822d --
Nov 24 14:54:47 GIR deCONZ[637]: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-jakob'
Nov 24 14:54:47 GIR deCONZ[637]: libpng warning: iCCP: known incorrect sRGB profile
Nov 24 14:54:47 GIR deCONZ[637]: This plugin does not support propagateSizeHints()
Nov 24 14:54:47 GIR deCONZ[637]: This plugin does not support propagateSizeHints()
Nov 24 14:54:47 GIR deCONZ[637]: This plugin does not support propagateSizeHints()
Nov 24 14:54:50 GIR deCONZ[637]: This plugin does not support propagateSizeHints()

Any suggestions are welcome :slight_smile:

Hi that is strange I’ll have a look. It seems that the close timeout isn’t triggering somehow.

After increasing the max open files to 65536, deconz now sometimes crashes(and recover) with this log line right before the crash: *** bit out of range 0 - FD_SETSIZE on fd_set ***: terminated
Other times it’s hanging - haven’t been at home when this happens, wife restarted server.

I’ll try downgrade deconz and see if this helps.

Took a while to figure out where it broke, I’ve reworked the HTTP handler to catch a few blocking errors and ensure connections aren’t staying open forever.

https://github.com/dresden-elektronik/deconz/commit/a2a8e2c432e0d3e73d1ae007534c378cdcc4a3a9

Tested the new beta today and it looks there is a 10 seconds between opening and closing. It looks like this interfering with the events on receiving updates from deconz on changing? Need to dive deeper, but this seems to be happening now