Page MenuHomeClusterLabs Projects

Avoid blocking wait in controller for CIB re-request
Open, NormalPublic

Assigned To
Authored By
kgaillot
Jan 7 2025, 3:29 PM
Tags
  • Restricted Project
  • Restricted Project
  • Restricted Project
Referenced Files
None
Subscribers

Description

Avoid the sleep(1) in daemons/controld/controld_schedulerd.c:do_pe_invoke_callback(). The easiest way would be a mainloop timer.

If the controller somehow gets in a loop requesting the CIB, the sleeps will be significant and can even get it killed by pacemakerd for being unresponsive.

Event Timeline

kgaillot triaged this task as Normal priority.Jan 7 2025, 3:29 PM
kgaillot created this task.
kgaillot created this object with edit policy "Restricted Project (Project)".

@waltdisgrace Adding a mainloop timer here is definitely the way to go. If you haven't looked at the mainloop stuff before (especially glib's implementation and what we've built on top of it), this could be a little bit confusing. The basic idea is that we fake being multithreaded by looping over a queue of events that can come from various sources like file or network IO, UNIX signals, periodic or one-off timers, and so forth. Using the main loop allows us to avoid blocking other work from happening.

Basically what you want to do here is remove the sleep call and all the code after it up to the return. Instead, add a timer that gets triggered in one second and calls a callback that does the same stuff as what you removed.

Testing is probably best done with a ctslab run.