Skip to content

gzip_ng_threaded prevents programs from crashing if a file is open #53

Closed
@D-VR

Description

@D-VR

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:

from zlib_ng import gzip_ng_threaded as gzip

file_ = gzip.open("Throwaway", "wb", threads=2)

raise Exception("weird")

example output (KeyboardInterrupt was used to quit the program):

~/venv/bin/python ~/testing.py 
Traceback (most recent call last):
  File "~/testing.py", line 5, in <module>
    raise Exception("weird")
Exception: weird

Exception ignored in: <module 'threading' from '/usr/lib/python3.12/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1622, in _shutdown
    lock.acquire()
KeyboardInterrupt: 

Process finished with exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions