Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread unsafe problem #88

Open
elephanter opened this issue Jan 23, 2015 · 0 comments
Open

thread unsafe problem #88

elephanter opened this issue Jan 23, 2015 · 0 comments

Comments

@elephanter
Copy link

Hello. The problem located in MongoEngineResource._wrap_polymorphic method. In place, where resource overrides its self._meta.object_class, self._meta.queryset and other "low level" fields.
So if I have polymorphic resource, maybe used in several places, I have chance to get wrong result. (what I saw in my project).
While that fields is overridden in resource class the method _wrap_request is working wrong. I do not look closer but i think because of this lines

    if resource._meta.object_class is self._meta.object_class:
        return fun()

We entered in "fun()". But in other thread we have finish dehydration, and already returned all that fields back to remembered values in finally section in _wrap_polymorphic method. Dehydration will be wrong in that case. Basically resource will have no additional fields which added by nested mongoengine documents. (I use polymorphic resource for return different documents, derived from one basic mongoengine document... so, when this error happens, i have only root document fields in result).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant