ffmpeg_reader is creating zombie processes
See original GitHub issueOpening a video file and deleting the variable leaves a zombie ffmpeg process running in the background. Steps to reproduce:
from moviepy.editor import VideoFileClip
import subprocess, gc
clip = VideoFileClip(PATH_TO_SOME_VIDEO)
del clip
gc.collect()
print([proc.args for proc in subprocess._active])
subprocess.run('echo hi', shell=True)
Output:
[['C:\\Users\\Rawing\\AppData\\Local\\imageio\\ffmpeg\\ffmpeg-win32-v3.2.4.exe',
'-i', 'D:\\users\\aran-fey\\desktop\\temp {e}\\SV card videos\\101221050 Navy L
ieutenant.mkv', '-loglevel', 'error', '-f', 'image2pipe', '-vf', 'scale=959:1484
', '-sws_flags', 'bicubic', '-pix_fmt', 'rgb24', '-vcodec', 'rawvideo', '-']]
Traceback (most recent call last):
File "temp.py", line 14, in <module>
subprocess.run('echo hi', shell=True)
File "C:\Python37\lib\subprocess.py", line 453, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python37\lib\subprocess.py", line 645, in __init__
_cleanup()
File "C:\Python37\lib\subprocess.py", line 215, in _cleanup
res = inst._internal_poll(_deadstate=sys.maxsize)
File "C:\Python37\lib\subprocess.py", line 1193, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid
As you can see, a ffmpeg process is running. The subprocess module tries to clean it up, but fails. Evidently, this ffmpeg process is spawned by the FFMPEG_VideoReader class, as the arguments match perfectly.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:11 (4 by maintainers)
Top Results From Across the Web
how to kill (or avoid) zombie processes with subprocess ...
When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the ......
Read more >Creating & troubleshooting Zombie processes in Python
These processes are zombie processes. Before discussing how to troubleshoot & create a zombie process, let's discuss what a zombie process ...
Read more >Zombie Processes and their Prevention
Zombie state: When a process is created in UNIX using fork() system call, the parent process is cloned. If the parent process calls...
Read more >How To Hunt, Kill and Remove a Zombie Process on Linux
If a parent process continues to create zombies, repair them straight away. This is important so the parents can properly call wait() to...
Read more >EDR: Zombie processes created by sensor
Environment EDR (CB Response) Server: All Supported Versions EDR Sensor: 7.1.0 Linux: All Supported Versions Symptoms Zombie processes ...
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

Thanks for the hint. I did, but still randomly get the same error.
Closing this since suggestions for dealing with the issue were provided.
Feel free to open a new issue following the issue template and referencing this older issue if the problem reoccurs.