[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
 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
       after 339 requests (339 known processed) with 0 events remaining.

 I created a partial solution that has been tested on linux here:
 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.

 Unfortunately posix & solaris say nothing along these lines and may delete
 the segment immediately (or at least prevent X from attaching to it)

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