-
Notifications
You must be signed in to change notification settings - Fork 349
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
Segmentation fault accessing attributes after closing container #1137
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is a valid bug! The problem is that self.ptr gets set to null when the container is closed. I'll try to put together a PR |
Calling `close()` on an input container calls `avformat_close_input` which will set the `self.ptr` AVFormatContext pointer to NULL. We need to ensure `self.ptr` is not NULL before using it. Fixes: #1137
Calling `close()` on an input container calls `avformat_close_input` which will set the `self.ptr` AVFormatContext pointer to NULL. We need to ensure `self.ptr` is not NULL before using it. Fixes: #1137
Calling `close()` on an input container calls `avformat_close_input` which will set the `self.ptr` AVFormatContext pointer to NULL. We need to ensure `self.ptr` is not NULL before using it. Fixes: PyAV-Org#1137
I found that this problem still exists. If the input container is closed and the input container is used as the output template, a Segmentation fault (core dumped) will be reported. import os.path as osp import av def make_sample_video(save_path,in_video_stream):
sample_file_path = "rainbow_noise.mp4" make_sample_video(sample_file_path,in_video_stream) time.sleep(3) print("Check duration:") |
Overview
I consistently get segmentation faults when trying to access certain attributes on an
InputContainer
after calling the .close() function.Most of the time I'm running in a REPL, so this behavior has been a bit of a landmine for me.
Expected behavior
Ideally the attribute would either return a value as expected for attributes that make sense to ask about 'after-the-fact' (i.e. getting the size or duration after closing the video) or otherwise raise an error.
Actual behavior
Simple example:
On Linux: I get the message:
Segmentation fault (core dumped)
and the script ends (it doesn't print out 'Finished!')On a Windows 10 VM (using cmd.exe): The script prints a single blank line, it doesn't say segmentation fault, but also doesn't print 'Finished!'
It doesn't seem to depend on the video (at least from the ones I've tested).
Investigation
I've checked each of the (non underscored) attributes to see which ones do/don't cause a crash (using the simple example above where the attribute is printed immediately after the call to close).
In the table below, (
InputContainer
) attributes on the left are fine (no segfault) attributes on the right always segfault:Hopefully there's some meaningful pattern here as to what leads to crashes, but I'm new to PyAV, so I have no idea...
I found a similar issue here: #1070
Though it seems to have been closed due to inactivity, and in fairness, may be tied to debugpy (not familiar with it).
Reproduction
You can try the simple example above with an existing video, or otherwise here's a version that creates a video first (needs
pip install av numpy
to run):For me, this will always segfault before reaching the 'Finished!' print out.
Versions
Research
I have done the following:
The text was updated successfully, but these errors were encountered: