Fix BlobIO cleanup deadlock · libgit2/pygit2@be67bec · GitHub
Skip to content

Commit be67bec

Browse files
Werkovjdavid
authored andcommitted
Fix BlobIO cleanup deadlock
When reading less than 8 KiB from the blob's data (io.DEFAULT_BUFFER_SIZE), the close() method would hang. Namely, close() thread would wait for self._writer_closed but the writer thread that'd set this is blocked by waiting in Blob__write_to_queue/.../blob_filter_stream_write/queue.put. The queue remains "full" (maxsize=1) because of unread data and no progress happens. Fix this by switching to "busy" wait for _writer_closed thus we empty the queue from the main thread and writer thread can proceed to its termination. Fixes #1488 Assisted-by: sonnet-5
1 parent 4e0803c commit be67bec

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

‎pygit2/blob.py‎

Lines changed: 14 additions & 4 deletions

0 commit comments

Comments
 (0)