Note that IA's attempt to fix this based on my recommended solution crashed and burned: AB-BA deadlock.
My followup recommendation involves jython's import lock, which would almost certain fix it, but would almost certainly come with serious performance regressions for those whose programming practices include abuse of the import statement.