Open tvalentyn opened 4 years ago
Any way to recover the corrupted data ? I suffered the same problem https://groups.google.com/g/comp.lang.python/c/FFfiN_TayfE/m/YUgdlG0PDwAJ
@redstoneleo: I'd agree with the commenters in the linked discussion... you can sometimes, with a lot of hard work, recover a corrupted pickle by hand, and he best way to guard against reading and writing to the same file is to (as @tvalentyn suggests) guard the operation with a lock.
@tvalentyn: this is still an open issue for CPython pickling, correct? You can see from the traceback that dill
falls down on this issue when it is relying on the CPython pickler.
As far as i know it's not fixed in CPython
This wasn't solved yet I guess ?
CPython pickler appears to be not thread-safe, and frequently causes deadlocks or corrupted module imports on Python 3.x when we concurrently unserialize pickles that reference same modules in the pickled payload [1].
A common manifestation of this error for Dill users is:
Another common manifestation is:
I am not sure yet whether this is WAI from CPython perspective, but I wanted to raise this issue for visibility in Dill land. Our mitigation plan for now is to guard pickle operations with a lock [2].
[1] https://issues.apache.org/jira/browse/BEAM-8651?focusedCommentId=16977923&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16977923 [2] https://github.com/apache/beam/pull/10167