[pulseaudio-tickets] [Bug 69711] New: mainloop wakeup is race-y and can eat 100% cpu

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Sep 23 06:12:41 PDT 2013


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

          Priority: medium
            Bug ID: 69711
                CC: lennart at poettering.net
          Assignee: pulseaudio-bugs at lists.freedesktop.org
           Summary: mainloop wakeup is race-y and can eat 100% cpu
        QA Contact: pulseaudio-bugs at lists.freedesktop.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: pierre-bugzilla at ossman.eu
          Hardware: Other
            Status: NEW
           Version: unspecified
         Component: core
           Product: PulseAudio

Created attachment 86366
  --> https://bugs.freedesktop.org/attachment.cgi?id=86366&action=edit
0005-mainloop-avoid-race-y-double-wakeup-status.patch

There's been a lot of fiddling with the mainloop's wakeup code since I wrote
it. Unfortunately the current implementation is race-y and can send pa_poll()
into a loop where it returns right away and the process starts eating 100% CPU.

What happens is:

 1. pa_mainloop_wakeup() is called.

 2. A wakeup byte is written on the pipe.

 3. The atomic status variable is updated.

 4. clear_wakeup() is called.

 5. The atomic status variable is checked, and reset.

 6. The pipe is read, but data has yet to propagate from the write end to the
read end so we get nothing.

 7. poll() is called, but returns quickly as there is now a byte sitting in the
pipe.

 8. clear_wakeup() is called, but won't read anything since the atomic status
claims the pipe is empty.

 9. goto 7.

The attached patch simply removes the extra variable. The pipe has atomic
properties so it is quite sufficient by itself.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20130923/f9ab34fd/attachment.html>


More information about the pulseaudio-bugs mailing list