Skip to content

thread unsafe problem #88

@elephanter

Description

@elephanter

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions