]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: sink: assume sft appctx stickiness
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 24 Jul 2024 13:57:04 +0000 (15:57 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 25 Jul 2024 12:56:19 +0000 (14:56 +0200)
commite328056ddc5029af0b34b3c8d757c49b33b7be76
tree287e6a8ceee42db0be7b96ff33807e02d319608a
parent28cb01f8e8580e5c3936b227e897b64a9e4c5c7e
MEDIUM: sink: assume sft appctx stickiness

As mentioned in b40d804 ("MINOR: sink: add some comments about sft->appctx
usage in applet handlers"), there are few places in the code where it
looks like we assumed that the applet callbacks such as
sink_forward_session_init() or sink_forward_io_handler() could be
executing an appctx whose sft is detached from the appctx
(appctx != sft->appctx).

In practise this should not be happening since an appctx sticks to the
same thread its entire lifetime, and the only times sft->appctx is
effectively assigned is during the session/appctx creation (in
process_sink_forward()) or release.

Thus if sft->appctx wouldn't point to the appctx that the sft was bound
to after appctx creation, it would probably indicate a bug rather than
an expected condition. To further emphasize that and prevent the
confusion, and since 3.1-dev4 was released, let's remove such checks and
instead add a BUG_ON to ensure this never happens.

In _sink_forward_io_handler(), the "hard_close" label was removed since
there are no more uses for it (no hard errors may be caught from the
function for now)
src/sink.c