I've got a Flask app run with Apache that uses some custom object that's serialized with jsonpickle
. When deserializing with jsonpickle.decode(my_json_string)
, there's nothing happening, meaning the method does not return anything nor does it throw an error. It's as if it just takes infinitely (haven't observed it finishing).
I've tried with a toy object that's just a few KB big, and I monitor hardware usage, and it's not a memory nor CPU problem.
What's more puzzling, using the same code to load the object in the Python console rather than Flask (using the same virtualenv), everything works smoothly, and the object is decoded in a matter of milliseconds.
import jsonpickle
with open("serialized_object.json") as f:
object_as_json = f.read() # this works, print(object_as_json) as expected
my_object = jsonpickle.decode(object_as_json)
This is Python 3.6.8, Flask 0.12.2, jsonpickle 1.2, Apache 2.4.
Line 5 in the code snippet above never finishes execution when run in Flask app/Apache. In the normal Python console, all works fine.
I'm afraid I don't know what more info to provide, but any help or pointers are greatly appreciated!
EDIT: I should perhaps add that the serialized object contains a Pytorch Module, but as I said that's really quite small.
UPDATE: I tried using pickle
instead and noticed exactly the same behaviour, strangely. I then removed some of the Pytorch components of the object and it all worked fine, so it seems like this is not a jsonpickle
/pickle
problem at all.