← Back to team overview

dx-packages team mailing list archive

[Bug 1235649] Re: uevent spam causes libdbus client code in session upstart to consume massive amounts of memory on Ubuntu Touch

 

I can now recreate the memory bloat using a basic NIH D-Bus server
program and associated client program.

1) Run the server as:

        $ ./test_nih_dbus_server unix:abstract=/com/hunt/james/foo
com.hunt.james.Foo /com/hunt/james/Foo

2) Run the client as:

        $ ./test_nih_dbus_client unix:abstract=/com/hunt/james/foo
com.hunt.james.Foo

3) Run the updated spammer as:

        $ ./spam_dbus_server.sh

4) Run top and watch the memory used by test_nih_dbus_server creep up.

The problem seems to be caused by the call to notify_clients() - this
sends a signal to every connected client every time the
spam_dbus_server.sh sends its data to the server. Commenting out the
call to notify_clients() stop the memory bloating issue.

The function echo_handled() that is called by notify_clients() is
analogous to control_emit_event_emitted() in Upstart parlance.

Again, running valgrind on the server shows the same stack traces as
above:

==30015== 91,750,175 bytes in 7,617 blocks are still reachable in loss record 164 of 164
==30015==    at 0x402BB88: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==30015==    by 0x408E778: dbus_realloc (dbus-memory.c:678)
==30015==    by 0x408F08C: reallocate_for_length (dbus-string.c:349)
==30015==    by 0x408F12B: set_length (dbus-string.c:390)
==30015==    by 0x408F1A9: open_gap (dbus-string.c:411)
==30015==    by 0x408FA67: copy (dbus-string.c:1198)
==30015==    by 0x408FCCE: _dbus_string_copy_len (dbus-string.c:1368)
==30015==    by 0x408DCF8: marshal_len_followed_by_bytes (dbus-marshal-basic.c:726)
==30015==    by 0x408DD95: marshal_string (dbus-marshal-basic.c:758)
==30015==    by 0x408DF60: _dbus_marshal_write_basic (dbus-marshal-basic.c:840)
==30015==    by 0x4075CD7: _dbus_type_writer_write_basic_no_typecode (dbus-marshal-recursive.c:1601)
==30015==    by 0x40768BB: _dbus_type_writer_write_basic (dbus-marshal-recursive.c:2323)


** Attachment added: "test_nih_dbus_server.c"
   https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1235649/+attachment/3878663/+files/test_nih_dbus_server.c

-- 
You received this bug notification because you are a member of DX
Packages, which is subscribed to unity in Ubuntu.
Matching subscriptions: dx-packages
https://bugs.launchpad.net/bugs/1235649

Title:
  uevent spam causes libdbus client code in session upstart to consume
  massive amounts of memory on Ubuntu Touch

Status in Upstart:
  New
Status in “linux” package in Ubuntu:
  Invalid
Status in “systemd” package in Ubuntu:
  Invalid
Status in “unity” package in Ubuntu:
  New
Status in “upstart” package in Ubuntu:
  Fix Released
Status in “linux” source package in Saucy:
  Invalid
Status in “systemd” source package in Saucy:
  Invalid
Status in “unity” source package in Saucy:
  New
Status in “upstart” source package in Saucy:
  Fix Released

Bug description:
  using ubuntu touch image 82 i see the session init consume about 10MB per minute as long as the screen is on  with Mir.
  running the same session with surfaceflinger only consumes 1MB per minute.

  in both cases the system starts to swap heavily at some point, making
  the UI unresponsive.

  http://paste.ubuntu.com/6196223/ has the top output of a Mir session
  after 30min, the UI just got completely unresponsive when this
  snapshot was taken.

  http://paste.ubuntu.com/6196332/ is the top output of a surfaceflinger
  session where the screen was off for about 10min

  apparently the leak only occurs while the screen is on, it seems to be
  permanently there but in the case of surfaceflinger it hits less hard.

To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/1235649/+subscriptions