Comment #6 on issue 627 by [email protected]: select.poll is not thread
safe (python issue 8865)
http://code.google.com/p/ganeti/issues/detail?id=627
commit 546c5100dece06b92ffa0804b6838b5125450bde
Author: Guido Trotter <[email protected]>
Date: Fri Nov 29 11:09:07 2013 +0100
SingleNotifyPipeCondition: don't share pollers
As widely known Ganeti uses a better[1] 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 <[email protected]>
Reviewed-by: Michele Tartara <[email protected]>
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings