summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-07-08 01:57:08 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-07-08 02:53:26 +0300
commit844812959beb1a6bbcc64099a4f85b3db127a8a4 (patch)
tree0c494e3b141ac5e53e1f18d05809b84be95f3ca3 /doc
parentf4014a4a2c9e654646faeb81cd9ac5841b1c9b0f (diff)
downloadaccel-ppp-844812959beb1a6bbcc64099a4f85b3db127a8a4.tar.gz
accel-ppp-844812959beb1a6bbcc64099a4f85b3db127a8a4.zip
triton: reject concurrent config reload requests
triton_conf_reload() kept the notify callback in a single global slot, and the CLI reload command likewise stored its wakeup context in a global. A second reload issued while the first was still pending (from another CLI connection or SIGUSR1) overwrote both, so only the last requester was notified when the reload completed; the earlier CLI context slept forever in triton_context_schedule() and that connection hung while the rest of the daemon kept running. Make triton_conf_reload() return -1 when a reload is already pending, checked atomically under threads_lock, and pass a caller-provided arg through to the notify callback so each requester keeps its own state instead of sharing globals. The CLI reload's request struct is heap-allocated rather than kept on reload_exec's stack, since triton_context_schedule() can migrate a suspended context onto a different worker thread's stack before the notify callback runs, which would otherwise leave conf_reload_notify() writing through a stale stack pointer. Also mark the reload as running (need_config_reload = 2) before dropping threads_lock to call __config_reload(). Previously a worker woken during the reload (e.g. by the notify callback waking the CLI context, or any stray context wakeup) could loop through the idle path, decrement the active count back to zero and re-enter __config_reload() while need_config_reload was still set, running a second concurrent conf_reload() and invoking the notify callback twice - corrupting the wakeup list and, with the CLI's heap request, writing through freed memory. The SIGUSR1 handler used to call triton_conf_reload() directly from signal context, taking spinlocks and potentially running the whole config parse inside the handler. It now only sets a flag; the main thread waits with sigtimedwait() and performs the reload (and logs a warning when one is already in progress) from normal thread context. The CLI now replies "reload is already in progress" instead of losing the first requester's wakeup.
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions