You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NethCTI server: each video source frame is sent once per connected client → nethcti-server runs out of memory #8294
On a NethVoice with one or more video sources configured and many CTI clients connected
Open the video sources page of the CTI with one or more users
Watch the memory of the nethcti-server process: it grows every second until the process crashes and restarts
Expected behavior
Every frame captured from a video source is sent once to each user subscribed to that source. nethcti-server memory stays stable regardless of the number of connected clients.
Actual behavior
nethcti-server memory grows up to ~2 GB, then the process crashes. On restart all the websocket connections drop, so every CTI client (not only the users watching the cameras) shows a connection error.
Observed on a production installation; lowering the sampling rate (frame-rate = 5000 in rest_cti_streaming) only mitigates it.
Root cause
In com_nethcti_ws.js, evtStreamingSourceChanged broadcasts each frame to the room of the source inside a loop over all the connected websockets:
Each subscriber receives the same base64 frame once per connected client (N sockets × M subscribers messages per frame, every frame-rate ms). Reproduced with socket.io 4.8: 150 connected sockets, 3 subscribers, 200 KB frame, 10 frames → ~4500 messages instead of 30 and +930 MB of RSS (vs +16 MB with a single emit).
Suggested fix
Emit the frame once to the room of the source, without the loop over wsid.
Components
nethcti-server (branch ns8, shipped in ghcr.io/nethesis/nethvoice-cti-server)
Setup: NethVoice with at least one video source (camera snapshot URL) with frame-rate = 1000, at least 3 users with the video source permission, several other CTI clients connected (web and/or NethLink).
Test Case 1 - Video source page shows the camera
User A opens the video sources page in the CTI: the image of the source is shown and refreshes about every second
In the browser devtools (WS frames), user A receives one streamingSourceUpdate per frame, not one per connected client
Test Case 2 - Multiple viewers
Users A, B and C open the video sources page at the same time: every user sees the image updating
Each user receives one streamingSourceUpdate per frame
Test Case 3 - nethcti-server memory stays stable
With users A, B and C watching for at least 10 minutes, the memory of nethcti-server (podman stats nethcti-server) stays stable and does not grow towards ~2 GB
nethcti-server does not restart and the other CTI clients do not show connection errors
Test Case 4 - Users not watching
A user connected to the CTI but not on the video sources page does not receive any streamingSourceUpdate
api-cli run update-module --data '{"module_url":"ghcr.io/nethesis/nethvoice:1.8.0-testing.112", "instances":["nethvoice<ID>"], "force": true}'
Test Case 5 - No sampling without viewers
With no user on the video sources page, nethcti-server does not request frames from the cameras (no streamingSourceChanged events in the nethcti-server logs, or no requests in the camera access log)
When a user opens the video sources page, the image appears within about one frame-rate interval and keeps refreshing
When the user leaves the page or puts the browser tab in background, sampling stops again; when the tab is visible again, the image resumes updating
Activity
tonyco97 commentedon Nov 6, 2026
Test
PR: nethesis/nethcti-server#379, nethesis/ns8-nethvoice#1167
Setup: NethVoice with at least one video source (camera snapshot URL) with
frame-rate= 1000, at least 3 users with the video source permission, several other CTI clients connected (web and/or NethLink).Test Case 1 - Video source page shows the camera
streamingSourceUpdateper frame, not one per connected clientTest Case 2 - Multiple viewers
streamingSourceUpdateper frameTest Case 3 - nethcti-server memory stays stable
nethcti-server(podman stats nethcti-server) stays stable and does not grow towards ~2 GBnethcti-serverdoes not restart and the other CTI clients do not show connection errorsTest Case 4 - Users not watching
streamingSourceUpdatetonyco97 commentedon Nov 6, 2026
Testing image:
Install command:
build(cti): update nethcti-server to sample video sources only with s…
edospadoni commentedon Nov 9, 2026
Testing image:
Includes nethesis/nethcti-server#380: video sources are sampled only when at least one user is subscribed to them (follow-up of nethesis/nethcti-server#379).
Install command:
Test Case 5 - No sampling without viewers
nethcti-serverdoes not request frames from the cameras (nostreamingSourceChangedevents in thenethcti-serverlogs, or no requests in the camera access log)frame-rateinterval and keeps refreshingedospadoni commentedon Nov 9, 2026
Release
nethesis/ns8-nethvoice1.8.0edospadoni commentedon Nov 9, 2026
Release
nethesis/ns8-nethvoice1.8.0