My Pylons application requires re-autoloading tables from time to
time, so I am calling clear_mappers() before autoloading tables. I ran
into an issue where clear_mappers() would hang and not return whenever
it was run from within the web app, and found that _COMPILE_MUTEX was
being acquired more times than it was being released.

In particular, when the compile() function was re-entered it would
acquire the mutex, but then return without releasing it. Adding a
release() call before returning fixed the problem, but I'm not sure if
this is the right thing to do. Is this actually a SQLAlchemy bug or am
I just overlooking something?

Here is the code in question, from mapper.py line 351:

_COMPILE_MUTEX.acquire()
global _already_compiling
if _already_compiling:
    # re-entrance to compile() occurs rarely, when a class-mapped
construct is
    # used within a ForeignKey, something that is possible
    # when using the declarative layer
    self.__initialize_properties()
    _COMPILE_MUTEX.release() # <-- ADDED BY ME
    return
_already_compiling = True

Thanks!
Scott

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to