« Previous | Next » 

Revision 546c5100

Parent 25bce647
Child affe1792

Added by Guido Trotter over 7 years ago

SingleNotifyPipeCondition: don't share pollers

As widely known Ganeti uses a better1 lock condition notification
library based on operating system pipes.

Inside this library we were using a shared poller for all threads
waiting for a condition. While poller is not thread safe, since (1)
we're holding the condition lock while calling poll and while parsing
results, and (2) we don't reuse the poller between different conditions,
or with newer fds our usage is actually safe. Unfortunately newer
versions of python take a hand-holding approach and don't trust us to do
the right thing. As such we are forced to create a new poller each time
we call wait.

This costs one system call more per wait, but practical measurements
have shown no significant impact on Ganeti. This is also a temporary
measures as newer versions will get away with the threading altogether
and move job schedulers to luxid.

The patch is losely based on a patch submitted by Daniel Néri, but has
been modified to reduce even further the scope of the poller variable to
just the waiter class.

[1] because I say so.
[1 bis] also because it produces fairer results, avoids possible
starvation and eliminates busy-wait polling.
[2] http://bugs.python.org/issue8865

Signed-off-by: Guido Trotter <>
Reviewed-by: Michele Tartara <>


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences