[BUG] GL-RM10 ustreamer leaks a file descriptor per FAILED snapshot

GL-RM10 (Comet Pro), firmware V1.10.0 release4 and V1.10.1 release2 — both affected.
ustreamer reports version 6.37 (GL build).

ustreamer leaks a file descriptor per FAILED snapshot, and kvmd never respawns it.

Repro:

  1. Leave the HDMI input with no signal (target powered off).
  2. Poll GET /api/streamer/snapshot repeatedly (any API client; ~1 req/6 s is enough).
  3. Watch ustreamer's fd count: ls /proc/$(pidof ustreamer)/fd | wc -l

Observed: ~2-3 fds leaked per failed request. They are UNIX sockets on
/run/kvmd/ustreamer.sock in state 03, held by ustreamer; kvmd correctly closes
its end (it stays at ~23 fds while ustreamer passes 600).
Snapshots taken WITH a live signal leak nothing — 20 consecutive HTTP 200s cost
0 fds on two separate units. The leak is on the failure path only.

At the 1024 soft limit:
kvmd.apps.kvmd.streamer INFO => [warn] Error from accept() call: Too many open files (x thousands)
kvmd.apps.kvmd.streamer DEBUG --- Terminating process pid=N
kvmd.apps.kvmd.streamer WARNING --- Process termination timed out after 3.0 seconds, sending SIGKILL
kvmd.apps.kvmd.streamer DEBUG --- Killing process group pgid=N

kvmd then NEVER restarts it. GET /api/streamer returns "streamer": null and every
snapshot returns 503 UnavailableError, with kvmd logging:
Can't connect to streamer: UnixClientConnectorError: Cannot connect to unix socket
/run/kvmd/ustreamer.sock [Connection refused]
All video stays dead until /etc/init.d/S98kvmd restart. HID, ssh and the rest of
the API are unaffected, so the unit looks healthy while video is gone.

Two separate asks:

  1. Close the accepted connection on the failure path in ustreamer.
  2. Have kvmd respawn the streamer after it kills it. Even with the leak, a working
    respawn would make this self-healing instead of an outage.

Side effect worth noting: the accept() error storm floods syslog and wipes the ring
buffer, so all pre-failure history is lost — which makes this hard to diagnose after
the fact.

Hi, thanks for the detailed report. Could you send the syslog to us?

And also found another bug, connman leaks a UDP socket per DNS query, then networking management dies.

I will send you private message with syslogs and both findings.