]> git.kaiwu.me - haproxy.git/commit
MINOR: applet: Add a destroy callback to the applets
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 8 Oct 2026 10:22:14 +0000 (12:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 9 Oct 2026 14:17:36 +0000 (16:17 +0200)
commit1b7dbcb3ce4d9e7ee8dacd2c85b9cd12b881d98c
treee5904622b87c9053cb8c5bed528af229980e2e88
parentc8f0eb83f2876fe9156d36061cde56d27a155bd0
MINOR: applet: Add a destroy callback to the applets

The applet ops provide callbacks for the applet lifecycle: an init callback
called before the applet starts processing, a shut callback called when one
side of the applet endpoint is shut, and a release callback called when both
sides are shut. But there is no callback called when the applet context is
destroyed, when its last user is released: the release callback may run long
before, while the stream attached to the applet is still alive, so the
applets holding references on objects used by their stream have no way to
know when to drop them.

Add a destroy callback to the applet ops, called by __appctx_free() when the
applet context is destroyed. It happens during the teardown of the stream
attached to the applet (from sc_destroy(), inside stream_free()). So this is
guaranteed to be after the last run of the stream, even if it was requeued
instead of being immediately freed.
include/haproxy/applet-t.h
include/haproxy/applet.h