- changed milestone to 0.4.xx
pool._DBProxy.get_pool doesn't look threadsafe
Issue #799
resolved
I was debugging some issues and ran across some code that doesn't look thread-safe - the code in pool._DBProxy.get_pool (called by pool._DBProxy.connect) does not appear to be thread-safe, and I'm not enough of a SQLAlchemy expert to understand the possible implications of this, so I thought I would at least let you know.
This is in 0.3.10
Comments (3)
-
repo owner -
repo owner this is targeted at 0.5.0 and is in 8220d9cdbe4ae97692a7676e4552572f1baa5131.
-
repo owner - removed milestone
Removing milestone: 0.5.0 (automated comment)
- Log in to comment
its very old code, from the first versions of SA. its not threadsafe in that theres a chance that extra pools can be created, although they'd immediately fall out of scope and then be gone for the rest of the app's lifespan..so the failure here wouldnt create very noticeable effects (additionally this is a very rarely used feature).
the mutex should be added in a new block that occurs after the KeyError so that no mutexing occurs unless the pool is not found (a second check should happen inside the mutex to ensure no other thread created it).