It looks like the use of directors for Ruby doesn't ensure that the calling thread is actually a native Ruby thread. That is, SWIG blindly makes the call to Ruby-land from any thread rather than marshalling the call to a Ruby thread first.
Calls to Ruby must happen on a Ruby thread (http://burgestrand.se/articles/asynchronous-callbacks-in-ruby-c-extensions.html) or otherwise the Ruby VM gets mighty upset: http://comments.gmane.org/gmane.comp.programming.swig/19854
A repro is available here: https://dl.dropboxusercontent.com/u/2406449/Swig/SwigRubyHang.7z
A fix is fairly trivial: All director calls should just be marshalled to a Ruby thread with e.g. rb_thread_create().
Reproducer link is 404 now.
The gmane link is to but I found the message via NNTP. Here's a different web archive:
https://swig-user.narkive.com/GNSQGcEc/director-in-ruby-hangs-ruby-vm
In case that disappears, the message-id is CALoZf3g3XdrRaLPNWYpBB=DK3VMuWexWreVacJJZAZ4P4twjZQ@mail.gmail.com
There are no hits for
git grep rb_thread
in current git master so it seems this hasn't been addressed still.The fix is described here, but an actual patch with test coverage is really needed (if someone wants to do that, please open a PR on github).