Skip to content
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

AVFrameWrapper falling out of scope before being freed by avcodec #398

Closed
totaam opened this issue Aug 1, 2013 · 19 comments
Closed

AVFrameWrapper falling out of scope before being freed by avcodec #398

totaam opened this issue Aug 1, 2013 · 19 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Aug 1, 2013

Issue migrated from trac ticket # 398

component: client | priority: critical | resolution: wontfix | keywords: win32

2013-08-01 09:30:08: antoine created the issue


As can be seen in #362#comment:6, it seems to be possible for a framewrapper to fall out of scope before it has been freed by avcodec.

This is caused by the buffer management code in #350 (r3976)

Please post log with XPRA_AVCODEC_DEBUG=1 for just 2 or 3 frames as per #350#comment:6.

Do you need to use a specific application to trigger those warnings?
Can you reproduce with a simple xterm?
Did you apply any patches when you built the installer for win32?
What version of ffmpeg did you build against?
I've uploaded a new win32 beta - please compare this with your build.

@totaam
Copy link
Collaborator Author

totaam commented Aug 1, 2013

2013-08-01 17:30:26: antoine edited the issue description

@totaam
Copy link
Collaborator Author

totaam commented Aug 2, 2013

2013-08-02 09:05:44: smo commented


Built new x264 and ffmpeg

ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20130801-2245-stable.tar.bz2
http://www.ffmpeg.org/releases/ffmpeg-1.2.2.tar.bz2

No more AVFrameWrapper messages after packaging a new installer with r4041

@totaam
Copy link
Collaborator Author

totaam commented Aug 2, 2013

2013-08-02 09:07:27: totaam changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Aug 2, 2013

2013-08-02 09:07:27: totaam changed resolution from ** to invalid

@totaam
Copy link
Collaborator Author

totaam commented Aug 2, 2013

2013-08-02 09:07:27: totaam commented


Great - closing as INVALID, must have been an old version of ffmpeg.

(may cause problems for us on some versions of libav/ffmpeg though..)

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 11:00:50: ahuillet commented


I see the problem with latest Archlinux (ffmpeg 2.0).

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 11:01:54: totaam changed status from closed to reopened

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 11:01:54: totaam changed resolution from invalid to **

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 11:01:54: totaam commented


Please post some output with XPRA_AVCODEC_DEBUG=1

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 11:02:04: totaam changed status from reopened to new

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 11:02:04: totaam changed owner from SmO to ahuillet

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 14:29:16: ahuillet commented


Edit by totaam: large comment moved to out-of-scope-debug.log attachment.
[[BR]]
Is that enough?

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 15:54:02: totaam commented


It seems to me like this happens when a window is destroyed, or resized, right? Is this with ffmpeg 2.x?
Can I get a bit more context?

[[BR]]

What I think is happening is that when we clean the decoder context, we clone the pixel data which calls xpra_free(), then when we call avcodec_close it calls av_free() and all is well. We lose all the references to the wrappers, they get garbage collected and we check that it is safe to free the reference (as the buffer should already have been freed by then).
That's on my version of ffmpeg... (Linux, OSX and win32)

[[BR]]
But here, I am not seeing a single av_free at all. It looks like the avcodec_release_buffer function is never called.

@totaam
Copy link
Collaborator Author

totaam commented Aug 7, 2013

2013-08-07 16:15:42: ahuillet commented


This is with ffmpeg 2.0. I did not check if it happened when a window was destroyed or resized, but I think it is a reasonable assumption - I remember I got my terminal flooded with those messages when I resized a xterm from very small to very big.

@totaam
Copy link
Collaborator Author

totaam commented Aug 10, 2013

2013-08-10 06:31:00: totaam commented


I am closing this ticket after testing on most supported platforms with ffmpeg 1.2.x. If this problem re-occurs with a supported version of ffmpeg, then we can re-open this ticket.

Support for ffmpeg 2.0 is now moved to #415


Note: the buffer support change was messy (esp compat for older versions - patches, etc):

@totaam
Copy link
Collaborator Author

totaam commented Aug 10, 2013

2013-08-10 06:41:09: totaam changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Aug 10, 2013

2013-08-10 06:41:09: totaam changed resolution from ** to wontfix

@totaam
Copy link
Collaborator Author

totaam commented Aug 10, 2013

2013-08-10 06:41:09: totaam commented


(actually closing it)

@totaam totaam closed this as completed Aug 10, 2013
@totaam
Copy link
Collaborator Author

totaam commented Dec 3, 2013

2013-12-03 06:22:12: totaam uploaded file out-of-scope-debug.log (24.6 KiB)

log sample for comment:7 (moving large waste of space comment to an attachment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant