]> git.kaiwu.me - haproxy.git/commit
MEDIUM: stream: Hold a reference on the frontend during stream_free()
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 8 Oct 2026 10:22:10 +0000 (12:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 9 Oct 2026 14:17:36 +0000 (16:17 +0200)
commitc8f0eb83f2876fe9156d36061cde56d27a155bd0
tree2b91d03e0c7d46c5808d9dffc8118b9994bc7bf8
parentd26aff11b5dcc9c17b44f8b42436b159a1f3c3c9
MEDIUM: stream: Hold a reference on the frontend during stream_free()

The frontend of a stream is dereferenced until the end of stream_free(), in
particular to flush the maximum amount of pools when the proxy is stopping.
But when the stream connectors are destroyed, a client applet attached to
the stream is released there, and it may free its internal frontend (created
owned by the applet), leaving the end of the function with a dangling
frontend.

Take a reference on the frontend before releasing the stream connector and
drop it at the very end of stream_free(), after the last dereference of the
frontend. For the frontends that are never released during the lifetime of
the process, this is a balanced pair of reference counter updates.

This will be needed by the next commits, adding a destroy callback to the
applet ops, called when an applet context is destroyed, which may release
the frontend of its applet stream.
src/stream.c