Release the GIL in more places to avoid deadlocks

This work started out with a Taurus GUI application that was deadlocked. Investigation of the callstack showed that it was busy handling an event callback in one thread, and and trying to exit in another (which called ApiUtil.cleanup()). The cleanup held the GIL, but was waiting for the event callback to finish. The event callback needed the GIL to continue.

After fixing that problem, the idea was to use Codex to investigate all the binding methods to look for similar problems. We are often having to fix these kinds of problems, so it would be good to do a bulk fix.

There are many fixes across event cleanup and queue access, callback and group operations, connections, database and attribute proxy property calls, server polling and lifecycle operations, and runtime attribute configuration. Many of these are extremely unlikely, but still good to fix.

The commits are grouped, so it may be easier to review one at a time.

All the Database client methods that need to, now release the GIL, which now opens up the possibility of a green mode Database client: #145.

Most of the new tests are quite slow to run, as we wait for deadlocks. Unfortunately, this adds almost 2 minutes to the total test suite run time.

The attached hand-off document has more details.

Co-authored-by: Codex codex@openai.com

gil-fixes-handoff.md

Edited by Anton Joubert

Merge request reports

Loading
Loading