You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having a serious problem. We are serializing a list of objects up to 100 objects at a time/per request and we have some custom field methods.
In these field methods, we pass the user_id in the context and perform some queries specific to that user_id. Now... I have noticed that sometimes this extra object field is wrong and after much investigation I found out that in some cases (within the list of objects in the same request!) the user_id was wrong and suddenly changed. The user_id passed through the context changed mid serialization of these 100 objects... I checked this "wrong" user and saw that his/her last activity was the same as mine what leads me to the conclusion that for some reason Marshmallow is not thread-safe and there is a race condition? Here is an example of my code:
Hello everybody,
I am having a serious problem. We are serializing a list of objects up to 100 objects at a time/per request and we have some custom field methods.
In these field methods, we pass the user_id in the context and perform some queries specific to that user_id. Now... I have noticed that sometimes this extra object field is wrong and after much investigation I found out that in some cases (within the list of objects in the same request!) the user_id was wrong and suddenly changed. The user_id passed through the context changed mid serialization of these 100 objects... I checked this "wrong" user and saw that his/her last activity was the same as mine what leads me to the conclusion that for some reason Marshmallow is not thread-safe and there is a race condition? Here is an example of my code:
I am unsure how to proceed now. I would need to fix this as soon as possible.
Thanks in advance.
The text was updated successfully, but these errors were encountered: