Skip to content

Fix connection leak in gst-client interactive mode#340

Open
clogwog wants to merge 2 commits intoRidgeRun:developfrom
clogwog:hotfix/fix-connection-leak-in-gst-client
Open

Fix connection leak in gst-client interactive mode#340
clogwog wants to merge 2 commits intoRidgeRun:developfrom
clogwog:hotfix/fix-connection-leak-in-gst-client

Conversation

@clogwog
Copy link
Copy Markdown

@clogwog clogwog commented May 6, 2026

see description #339

tom-mtdata and others added 2 commits May 6, 2026 10:02
In gstd_client_cmd_socket the GSocketConnection allocated by
g_socket_client_connect_to_host was only closed and unrefed on the
read/write error paths. The success path fell through to 'out:'
without closing, leaking one fd and one GObject per command.

On the gstd side this is more impactful than a typical client leak:
the threaded socket service holds a worker thread per open
connection (g_threaded_socket_service_new in gstd_tcp.c). After N
successful commands from an interactive gst-client session against
gstd started with --tcp-max-threads N, all worker slots are pinned
on idle leaked connections and subsequent connections queue
indefinitely.

Fold the close+unref into the unified 'out:' label so success and
error paths share a single cleanup, and guard with a NULL check so
the early-return path where g_socket_client_connect_to_host returns
NULL stays safe.
@clogwog
Copy link
Copy Markdown
Author

clogwog commented May 6, 2026

i thought i checked out my own fork and made the changes in there, but somehow my PR immediately showed up in the RidgeRun repo.. I may have done something wrong. if so, please feel free to delete the PR and i'll try again

@clogwog
Copy link
Copy Markdown
Author

clogwog commented May 6, 2026

tested the same test in #339 and it no longer hangs after a single request

gstd --tcp-max-threads 1
gst-client-1.0
gstd> list_pipelines  (works)
gstd> list_pipelines (works)
gstd> list_pipelines (works)
gstd> list_pipelines (works)
gstd> list_pipelines (works)

@clogwog
Copy link
Copy Markdown
Author

clogwog commented May 8, 2026

mmm maybe the connection isn't closed so things like eos notifications still arrive ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants