Fatal Python error: could not acquire lock for <_io.BufferedReader name=8> at interpreter shutdown, possibly due to daemon threads
See original GitHub issuePossibly related to #174
I’ve posted this on Stack Overflow (link) but can’t figure if it’s more suited for here. So apologies for double-posting.
Running the following:
import imageio
class vidrdf:
def __init__(self, vidfile):
self.vid = imageio.get_reader(vidfile, 'ffmpeg')
vidfile = 'movie.mov'
rdfobj = vidrdf(vidfile)
I get:
Fatal Python error: could not acquire lock for <_io.BufferedReader name=8> at interpreter shutdown, possibly due to daemon threads
Thread 0x00007fd2dc2a8700 (most recent call first):
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio_ffmpeg/_parsing.py", line 61 in run
File "miniconda3/envs/flower/lib/python3.7/threading.py", line 926 in _bootstrap_inner
File “/path/miniconda3/envs/flower/lib/python3.7/threading.py", line 890 in _bootstrap
Current thread 0x00007fd2f0bb9700 (most recent call first):
File “/path/miniconda3/envs/flower/lib/python3.7/subprocess.py", line 1704 in _communicate
File “/path/miniconda3/envs/flower/lib/python3.7/subprocess.py", line 939 in communicate
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio_ffmpeg/_io.py", line 193 in read_frames
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio/plugins/ffmpeg.py", line 342 in _close
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio/core/format.py", line 252 in close
File “/path/miniconda3/envs/flower/lib/python3.7/site-packages/imageio/core/format.py", line 241 in __del__
Aborted (core dumped)
For some reason this happens when running the code as a script, but not when run in a Jupyter notebook. It also happens in Python interactive environment only once Python is exited.
This also doesn’t happen when I replace self.vid=... with vid=... or replace rdfobj = vidrdf(vidfile) with just vidrdf(vidfile). So this seems to be an issue with copying the object (probably while daemon thread related to ffmpeg is closed?). Is there any resolution to this?
-Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How to fix a 'fatal Python error: _enter_buffered_busy
How to fix a 'fatal Python error: _enter_buffered_busy: could not aquire lock for <_io.BufferedWriter name='<stdout>'> at interpreter shutdown' ...
Read more >The python interpreter crashed with "_enter_buffered_busy"
... could not acquire lock for <_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads Python runtime ...
Read more >What are possible causes of this interpreter error?
Fatal Python error : could not acquire lock for <_io.BufferedWriter name='<stdout>'> at interpreter shutdown, possibly due to daemon threads.
Read more >Output console doesn't release stdin lock before finalization
Fatal Python error : could not acquire lock for <_io.BufferedReader name='<stdin>'> at interpreter shutdown, possibly due to daemon threads Python runtime ...
Read more >Daemon threads and the Python finalization in Python 3.2 and ...
Daemon threads. Python has a special kind of thread: "daemon" threads. The difference with regular threads is that Python doesn't wait until ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Reproduced. And confirmed that this is fixed by recent changes in
imageio-ffmpeg.I’ll fire up a Linux VM when I have a bit more time, but my current suspicion is that the generator has not finished because it has not read to the end, and them something goes wrong during cleanup when Python exist.