Opened 4 years ago

Last modified 4 years ago

#3235 new defect

ffmpeg doesn't respond to most signals on debian sid when using pulse input

Reported by: jnvsor Owned by:
Priority: minor Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

ffmpeg doesn't respond to SIGINT on debian sid when using a -f pulse input device.

Trying to send SIGINT through Ctrl+C or through kill -2 {pid} has no response. Stopping with q still works.

Running under valgrind ffmpeg does respond to sigint.

Removing any of the configure flags will cause the bug to dissapear (Except libpulse and prefix which are required to test it in the first place)

./configure --enable-libopencv --enable-libpulse --prefix=/home/j/FFmpeg --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu

Note about the output below. There are warning lines like so:

avutil      configuration: [...]

But these lines disappear when configured with --libdir=/usr/lib/x86_64-linux-gnu though the bug persists so I've cut them out of the output to make it more readable.

How to reproduce:

git clone git@github.com:FFmpeg/FFmpeg.git
cd FFmpeg
./configure --enable-libopencv --enable-libpulse --prefix=/home/j/FFmpeg --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu
make
make install
cd ~
./FFmpeg/bin/ffmpeg -f pulse -i default -c copy out.avi 
ffmpeg version N-59281-g64b98df Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 23:00:02 with gcc 4.8 (Debian 4.8.2-10)
  configuration: --enable-libopencv --enable-libpulse --prefix=/home/j/FFmpeg --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu
  WARNING: library configuration mismatch
[avutil lines]
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.006885, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'out.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     557kB time=00:00:02.87 bitrate=1587.9kbits/s
# Won't stop with sigint

Valgrind output:

valgrind ./FFmpeg/bin/ffmpeg -f pulse -i default -c copy out.avi 
==1989== Memcheck, a memory error detector
==1989== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==1989== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==1989== Command: ./FFmpeg/bin/ffmpeg -f pulse -i default -c copy out.avi
==1989== 
ffmpeg version N-59281-g64b98df Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 23:00:02 with gcc 4.8 (Debian 4.8.2-10)
  configuration: --enable-libopencv --enable-libpulse --prefix=/home/j/FFmpeg --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu
  WARNING: library configuration mismatch
[avutil lines]
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.064767, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'out.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     356kB time=00:00:01.82 bitrate=1596.9kbits/s    
video:0kB audio:342kB subtitle:0 global headers:0kB muxing overhead 3.959932%
Received signal 2: terminating.
==1989== 
==1989== HEAP SUMMARY:
==1989==     in use at exit: 64,699 bytes in 567 blocks
==1989==   total heap usage: 5,466 allocs, 4,899 frees, 1,699,733 bytes allocated
==1989== 
==1989== LEAK SUMMARY:
==1989==    definitely lost: 6,024 bytes in 1 blocks
==1989==    indirectly lost: 0 bytes in 0 blocks
==1989==      possibly lost: 0 bytes in 0 blocks
==1989==    still reachable: 58,675 bytes in 566 blocks
==1989==         suppressed: 0 bytes in 0 blocks
==1989== Rerun with --leak-check=full to see details of leaked memory
==1989== 
==1989== For counts of detected and suppressed errors, rerun with: -v
==1989== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Change History (20)

comment:1 in reply to: ↑ description Changed 4 years ago by cehoyos

Replying to jnvsor:

  WARNING: library configuration mismatch

This actually makes a bug report invalid if you are not specifically reporting an incompatibility. In that case, the exact output would be essential.

I cannot reproduce your problem on Opensuse, could you test with a simpler configure line, preferably the same I used (you don't have to install FFmpeg to test)?

$ ffmpeg -f pulse -i default -f null -
ffmpeg version N-59290-g8b285f0 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 23 2013 12:36:24 with gcc 4.7 (SUSE Linux)
  configuration: --enable-libopencv --enable-libpulse
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.637119, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=N/A time=00:00:01.27 bitrate=N/A
video:0kB audio:239kB subtitle:0 global headers:0kB muxing overhead -100.008989%
Received signal 2: terminating.

comment:2 Changed 4 years ago by jnvsor

Removing any of the options in that configure line makes the bug disappear, so that's as simple as I can make it.

The following is the simplest line that removes the library warning but retains the bug:

./configure --enable-libopencv --enable-libpulse --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static --prefix=$HOME/FFmpeg
make
sudo make install
cd
./FFmpeg/bin/ffmpeg -f pulse -i default -c copy out.avi
ffmpeg version N-59281-g64b98df Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 23 2013 13:30:37 with gcc 4.8 (Debian 4.8.2-10)
  configuration: --enable-libopencv --enable-libpulse --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static --prefix=/home/j/FFmpeg
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.311554, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'out.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     846kB time=00:00:04.37 bitrate=1582.4kbits/s
Last edited 4 years ago by jnvsor (previous) (diff)

comment:3 Changed 4 years ago by cehoyos

Are you sure that the problem disappears if you remove the --prefix option from configure?

comment:4 Changed 4 years ago by jnvsor

No, that's just there to stop make install messing with my system binaries (On that note, if you know a better way I'd love it)

Last edited 4 years ago by jnvsor (previous) (diff)

comment:5 Changed 4 years ago by cehoyos

As said, I never install to avoid this issue. I suggest doing the same when reporting bugs / simplifying a report.

I still cannot reproduce with your exact configure line:

$ ffmpeg -f pulse -i default -c copy out.avi
ffmpeg version N-59296-g5a1bfa7 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 23 2013 13:44:13 with gcc 4.7 (SUSE Linux)
  configuration: --enable-libopencv --enable-libpulse --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static --prefix=/home/c/FFmpeg
  libavutil      52. 59.100 / 52. 59.100
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.641061, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     250kB time=00:00:01.27 bitrate=1607.6kbits/s
video:0kB audio:239kB subtitle:0 global headers:0kB muxing overhead 4.656446%
Received signal 2: terminating.

To simplify the command line, could you test the following?

$ ffmpeg -f pulse -i default -f null -

comment:6 follow-up: Changed 4 years ago by jnvsor

Your command still shows the bug - I think it's specific to debian sid.

Since shlibdir is required for the bug to show I have to compile and install the libraries if I don't want the version mismatch warnings to pop up.

Is there a way to compile the binary statically? I tried the following but got an error:

$ ./configure --enable-libopencv --enable-libpulse --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu --disable-shared --enable-static --extra-libs=-static --extra-cflags=--static
ERROR: gnutls not found

That would help eliminate environment as a potential cause

Last edited 4 years ago by jnvsor (previous) (diff)

comment:7 in reply to: ↑ 6 Changed 4 years ago by cehoyos

Replying to jnvsor:

Since shlibdir is required for the bug to show I have to compile and install the libraries if I don't want the version mismatch warnings to pop up.

Why is that needed?
I may misunderstand, but are you missing the following to avoid installing a shared FFmpeg?

$ export LD_LIBRARY_PATH=libavutil/:libavcodec/:libavformat/:libavdevice/:libswscale/:libavfilter/:libswresample/

comment:8 Changed 4 years ago by jnvsor

I wish I knew - if I remove --enable libopencv --enable-gnutls or --shlibdir=/usr/lib/x86_64-linux-gnu the bug disappears.

$ export LD_LIBRARY_PATH=libavutil/:libavcodec/:libavformat/:libavdevice/:libswscale/:libavfilter/:libswresample/
$ ./configure --enable-libopencv --enable-libpulse --enable-gnutls --shlibdir=/usr/lib/x86_64-linux-gnu --disable-shared --enable-static --extra-libs=-static --extra-cflags=--static
ERROR: gnutls not found

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.

Actually now that I think of it - libopencv and gnutls aren't being compiled from ffmpeg are they? The problem is probably caused in the versions in the debian sid repos.

libgnutls-dev 2.12.23-8
libgnutls26   2.12.23-8
libgnutlsxx27 2.12.23-8
libgnutls28   3.2.7-3
libopencv-dev 2.4.6.1+dfsg-2

Edit: libopencv just had an update ->

libopencv-dev 2.4.6.1+dfsg-2+b1

But still here

Last edited 4 years ago by cehoyos (previous) (diff)

comment:9 Changed 4 years ago by cehoyos

$ export LD_LIBRARY_PATH=libavutil/:libavcodec/:libavformat/:libavdevice/:libswscale/:libavfilter/:libswresample/
$ ./configure ...

I was actually thinking of the following (to test):

$ ./configure --enable-shared
$ make ffmpeg
$ export LD_LIBRARY_PATH=libavutil/:libavcodec/:libavformat/:libavdevice/:libswscale/:libavfilter/:libswresample/
$ ./ffmpeg
Last edited 4 years ago by cehoyos (previous) (diff)

comment:10 Changed 4 years ago by jnvsor

Your LD.. line got the bug reproduced without the shlibdir option:

$ ./configure --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
$ make ffmpeg
$ export LD_LIBRARY_PATH=libavutil/:libavcodec/:libavformat/:libavdevice/:libswscale/:libavfilter/:libswresample/
$ ./ffmpeg -f pulse -i default -f null -
ffmpeg version N-59281-g64b98df Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 23 2013 19:28:29 with gcc 4.8 (Debian 4.8.2-10)
  configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 46.100 / 55. 46.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.013164, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=N/A time=00:00:02.01 bitrate=N/A

I'd love to git bisect this or something but every time I try to make an old commit it stops with No rule to make target $somefilehere

Last edited 4 years ago by jnvsor (previous) (diff)

comment:11 Changed 4 years ago by cehoyos

Just to make sure:
The problem is only reproducible with pulse input, not with anything else?
The problem is only reproducible with shared FFmpeg, not with --disable-shared --enable-static?
The problem is not reproducible if you don't enable libopencv?
The problem is not reproducible if you don't enable gnutls?

comment:12 Changed 4 years ago by jnvsor

I've tried various input devices (x11grab, pulse, alsa, files of various codecs) and pulse is the only one that causes the issue (That I know of)

It did happen with --enable-static --disable-shared but as the shared libraries weren't compiled I got the warning:

  configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-static --disable-shared
  WARNING: library configuration mismatch
  avutil      configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  avcodec     configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  avformat    configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  avdevice    configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  avfilter    configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  swscale     configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared
  swresample  configuration: --enable-libopencv --enable-libpulse --enable-gnutls --enable-shared

It was not reproducible if I removed libopencv or gnutls but now I can't compile if I remove either so I can't confirm (same error with either):

$ make ffmpeg
LD      libavcodec/libavcodec.so.55
/usr/bin/ld: libavcodec/mqc.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
libavcodec/mqc.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libavcodec/libavcodec.so.55] Error 1

comment:13 Changed 4 years ago by cehoyos

Please always run make distclean before rebuilding, that fixes both the issue with static building and with the incorrect compilation of mqc.o

comment:14 Changed 4 years ago by jnvsor

I can now confirm it does not occur if I omit either --enable-libopencv or --enable-gnutls (Sorry for needing all the hand-holding)

comment:15 Changed 4 years ago by cehoyos

But --enable-shared is not necessary?

comment:16 follow-up: Changed 4 years ago by jnvsor

Nope - I get the library config mismatch warnings but the bug persists.

comment:17 in reply to: ↑ 16 Changed 4 years ago by cehoyos

Replying to jnvsor:

Nope - I get the library config mismatch warnings but the bug persists.

This indicates that something went completely wrong at compilation time. Please test the following (in my opinion it is relevant to confirm that this has nothing to do with shared compilation):

$ make distclean
$ ./configure --enable-libopencv --enable-libpulse --enable-gnutls
$ make ffmpeg
$ ./ffmpeg -f pulse -i default -f null -

This should not show any library warnings (if it does, something else is broken), does it allow to reproduce the problem?
Which versions of opencv, gnutls (and pulse) are you using?

comment:18 Changed 4 years ago by jnvsor

With that configure line the bug still appears, and there is no library warning.

ii  libpulse-dev:amd64                    4.0-6+b1                          amd64        PulseAudio client development headers and libraries
ii  libpulse-mainloop-glib0:amd64         4.0-6+b1                          amd64        PulseAudio client libraries (glib support)
ii  libpulse0:amd64                       4.0-6+b1                          amd64        PulseAudio client libraries
ii  libpulse0:i386                        4.0-6+b1                          i386         PulseAudio client libraries
ii  pulseaudio                            4.0-6+b1                          amd64        PulseAudio sound server
ii  pulseaudio-module-x11                 4.0-6+b1                          amd64        X11 module for PulseAudio sound server
ii  pulseaudio-utils                      4.0-6+b1                          amd64        Command line tools for the PulseAudio sound server
ii  libgnutls-dev                         2.12.23-8                         amd64        GNU TLS library - development files
ii  libgnutls-openssl27:amd64             2.12.23-8                         amd64        GNU TLS library - OpenSSL wrapper
ii  libgnutls26:amd64                     2.12.23-8                         amd64        GNU TLS library - runtime library
ii  libgnutls26:i386                      2.12.23-8                         i386         GNU TLS library - runtime library
ii  libgnutls28:amd64                     3.2.7-3                           amd64        GNU TLS library - main runtime library
ii  libgnutlsxx27:amd64                   2.12.23-8                         amd64        GNU TLS library - C++ runtime library
ii  libopencv-core-dev:amd64              2.4.6.1+dfsg-2+b1                 amd64        development files for libopencv-core
ii  libopencv-core2.4:amd64               2.4.6.1+dfsg-2+b1                 amd64        computer vision core library
ii  libopencv-dev                         2.4.6.1+dfsg-2+b1                 amd64        development files for opencv
# A ton more libopencv packages with the same version number

These are the latest debian sid packages

comment:19 Changed 4 years ago by jnvsor

  • Summary changed from ffmpeg doesn't respond to SIGINT on debian sid when using pulse input to ffmpeg doesn't respond to most signals on debian sid when using pulse input

Well I'm an idiot, I should have checked more than just sigint.

Of the first 20 signals, 9 terminates the program and 19 puts it into background (where it can be restarted with $ fg) but there is no response to any of the other signals. (IE: Ctrl + Z won't put it into the background)

The next signal it responds to after 19 is 34, and from there on ffmpeg exits with "Real time signal #"

The weird thing is that while 17 19 and 23 are supposed to be sigstop ffmpeg only responds to 19. Afterwards it responds to sigcont when passed as 18, not as 19 or 25.

comment:20 Changed 4 years ago by jnvsor

Would it help if I just sent you the binary?

Note: See TracTickets for help on using tickets.