-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gzip_ng_threaded prevents programs from crashing if a file is open #53
Comments
Good catch. And nice of you to create a reproducer. I will see if I can get this into automated testing and make a patch. |
I was able to reproduce and produce a patch. This problem occurs when the file is not used with a context manager. As a result it will not get closed automatically and the threads aren't properly cleaned up. Very good catch. I am glad you reported it. |
Thank you for the quick response and patch! This is a cool package and I hope there will be more usage of it, more than happy to give a little back! edit: sorry for closing / opening the issue, realized it wasn't merged yet 😅 |
No worries. I will close it in appropriate time. Seems like there is a bug in Python 3.13 that prevents the fix from working. Which is unfortunate. Also checkout python-isal. It has the same bug (still need to fix that), but works with a different backend library which is even faster. |
Tried Definitely cool though, thanks for making these packages! |
Strange, on my also AMD cpu it is a lot faster (for compression). Unless maybe zlib-ng level 1 is used, but zlib-ng level 1 results in huge files even compared to normal gzip level 1. You could also tryout xopen. That should choose the most optimal gzip backend, no need to worry about that yourself. |
Seems to have been slowed by some background process! Ran it again and it's slightly faster |
If you use gzip_ng_threaded and open a file with multiple threads, any Exceptions thrown will cause Python to hang indefinitely.
This seems to be because the thread lock is never released.
Code to trigger the bug:
example output (KeyboardInterrupt was used to quit the program):
The text was updated successfully, but these errors were encountered: