Closed mcepl closed 1 year ago
That's pretty strange indeed, tho seems like file issue (like correpted or something) as you guess, instead of epy issue, but will have a look. Also thanks for the help answering other issues @mcepl
I think the background is https://github.com/python/cpython/issues/101911 … do you have any idea what could be the problem? It is weird, because code where it crashes is rather old. What has changed recently?
https://github.com/python/cpython/issues/101911#issuecomment-1442519220 suggests that the problem is with multiple threads (processes in our case) reading from one zipfile at once. And truly when I modify this line
just to set self._multiprocess_support
to False
, all problems go away.
Hmm, bisecting leads me to 3d6cc576607dd523195e5e8444612079645bb274, which seems strange. How could reverting lead to something like this?
I can confirm this sort of crash and that it's inconsistent; some days I can view any particular epub, and some days I get the EOFError. That definitely smells like a multiprocessing/locking issue to me. It's probably highly sensitive to the timings in the environment as to if it tickles the python/cpython#101911 bug.
The fix mcepl used works 100% for me. Force disable multiprocessing and I never have any trouble.
The referenced bug seems to indicate zipfile is not threadsafe, and epy doesn't seem to be using any locks, and the code around epub.py:188 has some exception handling and retries around other zlib related errors with multiprocessing. Not sure if adding EOFError to the exceptions caught and retried is sufficient, but it might be worth a try.
Hmm, what do you think of making a copy of the object for multiprocessing guys?
In fact, I'll try it right now.
Hey guys, try fixing this with https://github.com/wustho/epy/commit/ee3d6932be21b8bb69881d625b201758ee125eb3 Let me know if the issue still persist... Thanks!
Yes, it seems to be working fine with 6b0e9fe. However, not 100% certain as I was not able to 100% reproduce before. Thanks anyway for the effort!
No rush at all, thanks mate
Yes, I haven’t seen the crash any more. And yes, this is probably the worst commit message I have seen in a long time ;).
When trying to open the attached file with the latest checkout of epy, I get this crash when scrolling from the front page. I can easily open it with foliate and read it, so I don't think it is a problem with the file itself.
Using otherwise rather standard openSUSE/Factory with Python 3.10.10. Do you have any idea what’s going on, please?
Life as Petunia Evans-ao3_41805360.zip (renamed from
.epub
to.zip
because of GitHub.