<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [PATCH] dbus I/O is not dispatched"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89532">89532</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PATCH] dbus I/O is not dispatched
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>PulseAudio
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>core
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>pulseaudio-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dh.herrmann@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>pulseaudio-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>lennart@poettering.net
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=114218" name="attach_114218" title="Fix set_nice() to use private bus connections">attachment 114218</a> <a href="attachment.cgi?id=114218&action=edit" title="Fix set_nice() to use private bus connections">[details]</a></span>
Fix set_nice() to use private bus connections

Hi

In src/pulsecore/core-util.c:set_nice() we currently use a temporary
dbus-connection to set the nice-level via rtkit. However, we never close that
connection. This is fine, as the connection is shared and dbus-core will manage
it. But no other part of pulseaudio (with one exception, see below) uses the
libdbus1 managed connections. Therefore, we effectively end up with an unused
dbus-connection that is not integrated into any main-loop. dbus-daemon will
send bus-notifications to the connection (as libdbus1 installs matches for
those by default (it has to!)) until the outgoing queue is full. Thus, we waste
several KBs (or MBs? I didn't look it up) of memory for a message queue that is
never dispatched.

If you look at set_scheduler() in the same file, you see the only other user of
libdbus1 without pa_dbus. However, it correctly uses a private bus connection
via dbus_get_bus_private(). It also correctly closes _and_ unref's it after
it's done.

Note that you cannot call dbus_connection_close() on shared connections.
Therefore, I recommend fixing set_nice() to work exactly like set_scheduler().
An untested patch is attached. I don't have any clue what the rtkit stuff does,
so I cannot really test it. I hope you guys can give it a try.

Thanks
David</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>