hmarr/mongoengine — Issue #399: Possible threading issues with dereference.py
Author: djziegler
Created: 2011-12-30 12:24:37+00:00
State: open

While trying to add a simple dereference cache to dereference.py I noticed that there is a single global instance of DeReference (used for all dereferencing on all threads), and that the dereference methods store intermediate state on the self of this single global instance.

For example:

self.referenceMap is assigned in __call__() then referenced in _fetch_objects()

So while I haven't had any stompage issues yet, unless I am missing something, this is not thread safe.

I have really enjoyed mongoengine

-David