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
---------------------------------------------------------------------------
RecursionError Traceback (most recent call last)
/tmp/ipykernel_14051/80999944.py in <module>
8
9 s = pickle.dumps(Int(5))
---> 10 pickle.loads(s)
~/miniconda3/envs/aiida-latest/lib/python3.9/site-packages/aiida/orm/implementation/django/utils.py in __getattr__(self, item)
52 :return: the value of the model's attribute
53 """
---> 54 if self.is_saved() and self._is_mutable_model_field(item):
55 self._ensure_model_uptodate(fields=(item,))
56
~/miniconda3/envs/aiida-latest/lib/python3.9/site-packages/aiida/orm/implementation/django/utils.py in is_saved(self)
75 :return: boolean, True if the model is saved in the database, False otherwise
76 """
---> 77 return self._model.pk is not None
78
79 def save(self):
... last 2 frames repeated, from the frame below ...
~/miniconda3/envs/aiida-latest/lib/python3.9/site-packages/aiida/orm/implementation/django/utils.py in __getattr__(self, item)
52 :return: the value of the model's attribute
53 """
---> 54 if self.is_saved() and self._is_mutable_model_field(item):
55 self._ensure_model_uptodate(fields=(item,))
56
RecursionError: maximum recursion depth exceeded
Same error is produced if the AiiDA node is first store()ed.
Expected behavior
If the node is not going to be unpickled cleanly I would expect an error to be raised when pickling (e.g. "don't pickle AiiDA nodes; you're probably doing something wrong").
Thanks for the report @jbweston . Just for reference that this seems to be a problem with the Django backend, because for SqlAlchemy the code works fine:
Note that we are in the process of removing Django support and migrating automatically to SqlAlchemy and plan on releasing this with v2.0 in the upcoming months. If we don't find the time to find a fix for Django and backport it onto v1.6.5 that is.
#5330 indeed removes django, I'm not sure on the use case for picking an aiida node though, and therefore if we can/should support it.
An aiida node is tied to a "backend" instance, e.g. the PSQL database / disk-objectstore repository that its data is referencing. If you pickle/unpickle a node, what are you expecting to get back: should it also pickle the backend instance, but then if the backend is unpickled I guess it is going to try to load a connection to the database, which does not seem good.
Suffice to say, I think we should probably just "disallow" pickling of nodes
Describe the bug
Unpickling AiiDA types that were previously pickled raises
RecursionError
.Steps to reproduce
produces the following stack trace:
Same error is produced if the AiiDA node is first
store()
ed.Expected behavior
If the node is not going to be unpickled cleanly I would expect an error to be raised when pickling (e.g. "don't pickle AiiDA nodes; you're probably doing something wrong").
Your environment
Other relevant software versions, e.g. Postres & RabbitMQ N/A
The text was updated successfully, but these errors were encountered: