[issue16569] Preventing errors of simultaneous access in zipfile
Serhiy Storchaka added the comment: Closed in favor of issue14099. -- resolution: - rejected stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
David Wilson added the comment: Compared to the cost of everything else ZipExtFile must do (e.g. 4kb string concatenation in a loop, zlib), its surprising that lseek() would measurable at all. The attached file 'patch' is the minimal change I tested. It represents, in terms of computation and system call overhead, all required to implement the seek before read solution to simultaneous access. On OSX, churning over ever member of every ZIP in my downloads directory (about 400mb worth), this change results in around 0.9% overhead compared to the original module. Subsequently I'm strongly against the patch here. It is in effect papering over an implementation deficiency of the current zipfile module, one that could easily and cheaply be addressed. (My comment on this ticket is in the context of the now-marked-duplicate issue22842). -- nosy: +dw Added file: http://bugs.python.org/file37172/patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Changes by Serhiy Storchaka storch...@gmail.com: -- Removed message: http://bugs.python.org/msg176850 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Changes by Serhiy Storchaka storch...@gmail.com: -- Removed message: http://bugs.python.org/msg176851 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Serhiy Storchaka added the comment: Seek can be very cheap. Anybody could actually measure it??? I am waiting for an updated patch for issue14099 to make benchmarks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Jesús Cea Avión added the comment: Seek can be very cheap. Anybody could actually measure it??? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Stepan Kasal added the comment: I agree that reading from a file open for write should be forbidden, no matter whether ZipFile was called with fp or a name. Actually, it is not yet forbidden, and two of the tests in the zipfile.py test suite do actually rely on this misfeature. The first chunk in the patch http://bugs.python.org/file24624/Proposed-fix-of-issue14099-second.patch contains a fix for this bug in test suite. OTOH, decompressing several files for a given zip file simultaneously does not sound that bad. You know, with all the current file managers, people look at a zip as if it were kind of a directory. -- nosy: +kasal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Serhiy Storchaka added the comment: Test: http://bugs.python.org/file24624/Proposed-fix-of-issue14099-second.patch file24624 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Serhiy Storchaka added the comment: Test: file24624/Proposed-fix-of-issue14099-second.patch -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Serhiy Storchaka added the comment: Actually, it is not yet forbidden, and two of the tests in the zipfile.py test suite do actually rely on this misfeature. Indeed. I missed that. Actually these tests work by accident, due to the fact that the contents of the zipfile is placed in the file object buffer. OTOH, decompressing several files for a given zip file simultaneously does not sound that bad. You know, with all the current file managers, people look at a zip as if it were kind of a directory. I agree, but I'm afraid it's impossible to do without performance regression due to seek before every read. And for now ZipFile is not support simultaneous reading when external file object used. Also ZipFile is not thread-safe in any case. You can open several ZipFiles for simultaneous reading. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Stepan Kasal added the comment: but I'm afraid it's impossible to do without performance regression due to seek before every read. I agree that this is key question. I would hope that the performance hit wouldn't be so bad, unless there are actually two decompressions running concurrently. So we can have an implementation that is generally correct, though some use scenarios result in slow execution. OTOH, if the seek() call were a problem even if the new position is the same as the old one, they can be optimized out by a simple wrapper around fp. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
New submission from Serhiy Storchaka: If the ZipFile was created by passing in a file-like object as the first argument to the constructor, then simultaneous reading or writing of different file results in an non-consistent state. There is a warning about this in the documentation. The proposed patch forces this condition, raising the early exception if you attempt to simultaneously access. I'm not sure whether it's worth apply to older versions. -- components: Library (Lib) files: zipfile_simultaneous.patch keywords: patch messages: 176544 nosy: alanmcintyre, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Preventing errors of simultaneous access in zipfile type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file28147/zipfile_simultaneous.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Jesús Cea Avión added the comment: I am -0 to this. We can't prevent programmers for shotting in the foot. -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16569] Preventing errors of simultaneous access in zipfile
Serhiy Storchaka added the comment: Reading from closed ZipFile or reading from ZipFile opened for write already forbidden. This is a preventing of the same kind. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16569 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com