[FFmpeg-trac] #3169(avdevice:new): x11grab leaks shared memory if X server shuts down
FFmpeg
trac at avcodec.org
Tue Nov 26 02:19:57 CET 2013
#3169: x11grab leaks shared memory if X server shuts down
--------------------------------------+------------------------------------
Reporter: levialliance | Owner:
Type: defect | Status: new
Priority: normal | Component: avdevice
Version: git-master | Resolution:
Keywords: x11grab | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
--------------------------------------+------------------------------------
Comment (by levialliance):
Extra av_log debugging output with SIGINT:
{{{
Press [q] to stop, [?] for help
video:25920kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.000000%
fmpeg_cleanup() called
avformat_close_input() called
x11grab_read_close() called
x11grab_read_close() done
avformat_close_input() done
Received signal 2: terminating.
ffmpeg_cleanup() done.
}}}
With X shutdown:
{{{
Press [q] to stop, [?] for help
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server
":0"kbits/s
after 339 requests (339 known processed) with 0 events remaining.
}}}
I created a partial solution that has been tested on linux here:
https://github.com/levic/FFmpeg/compare/FFmpeg:master...master
It's only a partial solution because while it solves SIGKILL/X disconnect
for x11grab, if any other filters/input devices need to be cleanly shut
down they still won't be if x11grab encounters an X disconnect.
On linux and freebsd, you can mark the segment for deletion while
processes are still attached and it will automatically clean up when the
attached process count goes to zero.
http://linux.die.net/man/2/shmctl
http://www.freebsd.org/cgi/man.cgi?query=shmctl&sektion=2
Unfortunately posix & solaris say nothing along these lines and may delete
the segment immediately (or at least prevent X from attaching to it)
http://docs.oracle.com/cd/E19109-01/tsolaris8/835-8003/6ruu1b0qp/index.html
http://pubs.opengroup.org/onlinepubs/007904975/functions/shmctl.html
http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2005-04/0599.html
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3169#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list