Hi there,<br /><br />I am currently working on a python script that makes use of the python-lxc library (lxc version is the current git version). I had a timer running that would stop the container if the attach_wait method took to long to return. However the event was not triggered before the attach_wait method returned no matter how long this took.<br />As far as I know the problem can be fixed by making the Container_attach_and_possibly_wait function in python-lxc/lxc.c GIL-aware. Tested this with the script provided below and it worked fine for me.<br />Here is a minimal python script which should be able to reproduce the problem given a running container "test":<br />  <br />import lxc<br />import threading<br /><br /><br />def event():<br />    print("Hello")<br /><br /><br />def main():<br />    container = lxc.Container("test")<br />    timer = threading.Timer(2, event)<br />    timer.start()<br />    container.attach_wait(lxc.attach_run_command, ["/bin/sleep", "7"])<br />    print("all done")<br /><br />if __name__ == "__main__":<br />    main()<br />    <br />On my system both prints were executed after approx 7 secs.<br />After applying the following changes to lcx.c the "Hello" string was printed correctly approx 5 secs ahead of "all done":<br />  <br />in Container_attach_and_possibly_wait starting at line 583:<br /><br />if (wait) {<br />     Py_BEGIN_ALLOW_THREADS<br />     ret = lxc_wait_for_pid_status(pid);<br />     Py_END_ALLOW_THREADS<br />     (...)<br />     <br />I hope this was helpful.<br />  <br />Regards,<br />  <br />Dorian Eikenberg