Message381139
I have not observed any segfaults yet. Only zipfile.BadZipFile exceptions so far.
The exact file at which it crashes is fairly random. It even crashes if all threads try to read the same file multiple times.
I think the root cause of the problem is that the reads of zef_file in ZipFile.read are not locked properly.
https://github.com/python/cpython/blob/c79667ff7921444911e8a5dfa5fba89294915590/Lib/zipfile.py#L1515
The underlying file object is shared between all ZipExtFiles. Every time a thread makes a call to ZipFile.read, a new lock is created in _SharedFile, but that lock only protects against multiple threads reading the same ZipExtFile. Multiple threads reading different ZipExtFiles with the same underlying file object will cause trouble. The locks do nothing in this scenario because they are individual to each thread and not shared. |
|
Date |
User |
Action |
Args |
2020-11-16 18:40:07 | Thomas | set | recipients:
+ Thomas, eric.smith, malin |
2020-11-16 18:40:07 | Thomas | set | messageid: <1605552007.67.0.00602354620285.issue42369@roundup.psfhosted.org> |
2020-11-16 18:40:07 | Thomas | link | issue42369 messages |
2020-11-16 18:40:06 | Thomas | create | |
|