]> git.ipfire.org Git - thirdparty/freeradius-server.git/commit
rlm_kafka: debug-build sanity check that dr / error cbs run on-thread
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 22 Apr 2026 17:12:50 +0000 (13:12 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 22 Apr 2026 17:12:50 +0000 (13:12 -0400)
commitffad24d4d1871d7818a7066dfc55e76a44915a23
tree1f4500268d84fa99fa0327d8055842a361007a0f
parent26eb236dc7a4e46e709d1f90c86eb688e83a86da
rlm_kafka: debug-build sanity check that dr / error cbs run on-thread

Capture pthread_self() into rlm_kafka_thread_t at thread_instantiate,
then assert the same tid in _kafka_delivery_report_cb and
_kafka_error_cb.  librdkafka only wakes us via the main queue (which
we poll from the worker's event loop), so a cross-thread hit would
mean an event slipped a different path and the no-lock handling of
the inflight list is unsafe.

Field and assertions are #ifndef NDEBUG so release builds carry
neither the extra tid nor the check - fr_assert(_x) expands to
nothing under NDEBUG so the missing field doesn't matter.
src/modules/rlm_kafka/rlm_kafka.c