Comment 6 for bug 1495871

Revision history for this message
Gerry Boland (gerboland) wrote : Re: unity8 leaks file descriptors

Watching the eventfd2 & close calls to see which one leaks:

sudo strace -p `pidof unity8` 2>&1 | grep -P "(eventfd|close)"

I get on app open:

eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 118
eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 117
close(117) = 0
eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 116
close(116) = 0

on app close:

eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 109
close(109) = 0
eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 109
close(109) = 0
eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 109
close(109) = 0
eventfd2(0, O_NONBLOCK|O_CLOEXEC) = 109
close(109) = 0

I saw no close call for FD 118 - the first one.

In gdb the first eventfd call on app launch has this backtrace:

Breakpoint 1, 0xb614ae36 in eventfd () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) bt
#0 0xffffffff in eventfd () at /lib/arm-linux-gnueabihf/libc.so.6
#1 0xffffffff in g_wakeup_new () at /build/buildd/glib2.0-2.44.1/./glib/gwakeup.c:146
#2 0xffffffff in g_main_context_new () at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:624
#3 0xffffffff in cgroup_manager_connection () at /build/ubuntu-app-launch-qvXALV/ubuntu-app-launch-0.5+15.04.20150827/helpers-shared.c:153
#4 0xffffffff in pids_for_appid (appid=appid@entry=0xa1f1e8 "dialer-app") at /build/ubuntu-app-launch-qvXALV/ubuntu-app-launch-0.5+15.04.20150827/libubuntu-app-launch/ubuntu-app-launch.c:1515
#5 0xffffffff in ubuntu_app_launch_pid_in_app_id (pid=17487, appid=0xa1f1e8 "dialer-app") at /build/ubuntu-app-launch-qvXALV/ubuntu-app-launch-0.5+15.04.20150827/libubuntu-app-launch/ubuntu-app-launch.c:1576
#6 0xffffffff in qtmir::upstart::ApplicationController::appIdHasProcessId(int, QString const&) (this=<optimized out>, pid=17487, appId=...) at /home/gerry/dev/projects/qtmir/multimonitor/src/modules/Unity/Application/upstart/applicationcontroller.cpp:180
#7 0xffffffff in qtmir::TaskController::appIdHasProcessId(QString const&, unsigned long long) const (this=this@entry=0x61b138, appId=..., pid=<optimized out>) at /home/gerry/dev/projects/qtmir/multimonitor/src/modules/Unity/Application/taskcontroller.cpp:94
#8 0xffffffff in qtmir::ApplicationManager::authorizeSession(unsigned long long, bool&) (this=0x618328, pid=<optimized out>, authorized=@0xadefeb2c: false) at /home/gerry/dev/projects/qtmir/multimonitor/src/modules/Unity/Application/application_manager.cpp:557
#9 0xffffffff in QMetaCallEvent::placeMetaCall(QObject*) (a=<optimized out>, r=0x618328, this=0x62c248) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:124
#10 0xffffffff in QMetaCallEvent::placeMetaCall(QObject*) (this=<optimized out>, object=0x618328) at kernel/qobject.cpp:483
#11 0xffffffff in QObject::event(QEvent*) (this=<optimized out>, e=<optimized out>) at kernel/qobject.cpp:1245
#12 0xffffffff in QCoreApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:997
#13 0xffffffff in QCoreApplication::notifyInternal(QObject*, QEvent*) (this=0x518f00, receiver=receiver@entry=0x618328, event=event@entry=0x14edba0) at kernel/qcoreapplication.cpp:935
#14 0xffffffff in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (event=0x14edba0, receiver=0x618328) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:228
#15 0xffffffff in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x5194c8) at kernel/qcoreapplication.cpp:1552
#16 0xffffffff in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1410
#17 0xffffffff in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x536aa0) at kernel/qeventdispatcher_glib.cpp:271
#18 0xffffffff in g_main_context_dispatch (context=0x537390) at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3122
#19 0xffffffff in g_main_context_dispatch (context=context@entry=0x537390) at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3737
#20 0xffffffff in g_main_context_iterate (context=context@entry=0x537390, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3808
#21 0xffffffff in g_main_context_iteration (context=0x537390, may_block=1) at /build/buildd/glib2.0-2.44.1/./glib/gmain.c:3869
#22 0xffffffff in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x537620, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#23 0xffffffff in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0xbedaa278, flags=..., flags@entry=...) at kernel/qeventloop.cpp:204
#24 0xffffffff in QCoreApplication::exec() () at kernel/qcoreapplication.cpp:1188
#25 0x0001407e in ()
#26 0xffffffff in __libc_start_main () at /lib/arm-linux-gnueabihf/libc.so.6
#27 0x00014590 in _start ()
(gdb) cont

Suspect the leak is in ubuntu-app-launch