Hi,

attaching to a container using attach_wait from python-lxc blocks all other 
threads since it is not GIL-aware.
This can be a problem if you want to run a timer thread, which stops the 
container after a certain timeout has occured.
I've provided a solution below:

diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
index 1bc977a..91c199f 100644
--- a/src/python-lxc/lxc.c
+++ b/src/python-lxc/lxc.c
@@ -581,7 +581,9 @@ Container_attach_and_possibly_wait(Container *self, 
PyObject *args,
 goto out;
 
 if (wait) {
+ Py_BEGIN_ALLOW_THREADS
 ret = lxc_wait_for_pid_status(pid);
+ Py_END_ALLOW_THREADS
 /* handle case where attach fails */
 if (WIFEXITED(ret) && WEXITSTATUS(ret) == 255)
 ret = -1;


Signed-off-by: Dorian Eikenberg <dorian.eikenberg at uni-duesseldorf.de>
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to