[pulseaudio-tickets] [Bug 45643] New: padsp wrapper is racy at startup

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Feb 5 02:53:22 PST 2012


https://bugs.freedesktop.org/show_bug.cgi?id=45643

             Bug #: 45643
           Summary: padsp wrapper is racy at startup
    Classification: Unclassified
           Product: PulseAudio
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: tools
        AssignedTo: pulseaudio-bugs at lists.freedesktop.org
        ReportedBy: slyfox at inbox.ru
         QAContact: pulseaudio-bugs at lists.freedesktop.org
                CC: lennart at poettering.net


Initial symptomes: libmikmod clients SIGSEGV when ran under 'padsp'
wrapper. The reason is padsp returns incorrect buffer fill info:

(reproducer: PADSP_DEBUG=3 padsp mikmod some_files)

utils/padsp.c:fragsize=16384, fragstotal=16, bytes=262144, fragments=16
utils/padsp.c:fragsize=16384, fragstotal=16, bytes=262144, fragments=16

utils/padsp.c:fragsize=16384, fragstotal=16, bytes=-16385, fragments=-1
<mikmod SIGSEGV. When patch mikmod to ignore such strange fragments
I get playing sounds. and log restores state:>
utils/padsp.c:fragsize=16384, fragstotal=16, bytes=245760, fragments=15
...


I've added debug info to padsp.c and stream.c to see where stream state flips
from READY back to _CREATING and I think i'bve figured out where:

Log with additional debug info:
    state=4 - _READY stream state
    state=1 - _CREATING stream state

utils/padsp.c: dsp_open() succeeded, fd=3; state=4
utils/padsp.c: SNDCTL_DSP_SETFRAGMENT: 0x0010000e
utils/padsp.c: SNDCTL_DSP_GETFMTS
utils/padsp.c: SNDCTL_DSP_SETFMT: 16
utils/padsp.c: SNDCTL_DSP_CHANNELS: 2
utils/padsp.c: SNDCTL_DSP_SPEED: 48000
utils/padsp.c: ss: s16le 2ch 48000Hz
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: ioctl()
utils/padsp.c:(ctx=(nil)) fragsize=16384, fragstotal=16, bytes=262144,
fragments=16 (state=4)

   no player context, but stream is considered ready

utils/padsp.c: fopen(a94final.uni)
utils/padsp.c: fclose()
utils/padsp.c: open(a94final.uni)
utils/padsp.c: fclose()
utils/padsp.c: ioctl()
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: ioctl()
utils/padsp.c:(ctx=(nil)) fragsize=16384, fragstotal=16, bytes=262144,
fragments=16 (state=4)

utils/padsp.c: ref--, now 1
utils/padsp.c: ioctl()
utils/padsp.c: ref++, now 2
utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: pa_stream_new() called!

pa_stream_set_state(0xa37f40): 0->1
   created player context and switches stream back to _CREATING

pa_stream_writable_size(0xa37f40) is forky?
pa_stream_writable_size(0xa37f40) is ready? (s->state=1)
   _CREATING i not READY, so fail

utils/padsp.c: pa_stream_writable_size(0xa37f40): Bad state; state=4
(PA_STREAM_CREATING=1)
utils/padsp.c: ioctl()
utils/padsp.c:(ctx=0xa37f40) fragsize=16384, fragstotal=16, bytes=-16385,
fragments=-1 (state=4)

   and return garbage to client

A little after..
pa_stream_set_state(0xa37f40): 1->2
utils/padsp.c: stream established.

  something happened in event io thread (io_event_cb was activated and
create_playback_stream() started creating)

utils/padsp.c: SNDCTL_DSP_GETOSPACE
utils/padsp.c: ioctl()
utils/padsp.c:(ctx=0xa37f40) fragsize=16384, fragstotal=16, bytes=245760,
fragments=15 (state=4)

  and things got back to normal

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the pulseaudio-bugs mailing list