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
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 O_CLOEXEC) = 117 O_CLOEXEC) = 116
eventfd2(0, O_NONBLOCK|
close(117) = 0
eventfd2(0, O_NONBLOCK|
close(116) = 0
on app close:
eventfd2(0, O_NONBLOCK| O_CLOEXEC) = 109 O_CLOEXEC) = 109 O_CLOEXEC) = 109 O_CLOEXEC) = 109
close(109) = 0
eventfd2(0, O_NONBLOCK|
close(109) = 0
eventfd2(0, O_NONBLOCK|
close(109) = 0
eventfd2(0, O_NONBLOCK|
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 linux-gnueabihf /libc.so. 6 buildd/ glib2.0- 2.44.1/ ./glib/ gwakeup. c:146 buildd/ glib2.0- 2.44.1/ ./glib/ gmain.c: 624 manager_ connection () at /build/ ubuntu- app-launch- qvXALV/ ubuntu- app-launch- 0.5+15. 04.20150827/ helpers- shared. c:153 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 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 upstart: :ApplicationCon troller: :appIdHasProces sId(int, QString const&) (this=<optimized out>, pid=17487, appId=...) at /home/gerry/ dev/projects/ qtmir/multimoni tor/src/ modules/ Unity/Applicati on/upstart/ applicationcont roller. cpp:180 TaskController: :appIdHasProces sId(QString const&, unsigned long long) const (this=this@ entry=0x61b138, appId=..., pid=<optimized out>) at /home/gerry/ dev/projects/ qtmir/multimoni tor/src/ modules/ Unity/Applicati on/taskcontroll er.cpp: 94 ApplicationMana ger::authorizeS ession( unsigned long long, bool&) (this=0x618328, pid=<optimized out>, authorized= @0xadefeb2c: false) at /home/gerry/ dev/projects/ qtmir/multimoni tor/src/ modules/ Unity/Applicati on/application_ manager. cpp:557 :placeMetaCall( QObject* ) (a=<optimized out>, r=0x618328, this=0x62c248) at ../../include/ QtCore/ ../../src/ corelib/ kernel/ qobject_ impl.h: 124 :placeMetaCall( QObject* ) (this=<optimized out>, object=0x618328) at kernel/ qobject. cpp:483 :event( QEvent* ) (this=<optimized out>, e=<optimized out>) at kernel/ qobject. cpp:1245 n::notify( QObject* , QEvent*) (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at kernel/ qcoreapplicatio n.cpp:997 n::notifyIntern al(QObject* , QEvent*) (this=0x518f00, receiver= receiver@ entry=0x618328, event=event@ entry=0x14edba0 ) at kernel/ qcoreapplicatio n.cpp:935 nPrivate: :sendPostedEven ts(QObject* , int, QThreadData*) (event=0x14edba0, receiver=0x618328) at ../../include/ QtCore/ ../../src/ corelib/ kernel/ qcoreapplicatio n.h:228 nPrivate: :sendPostedEven ts(QObject* , int, QThreadData*) (receiver= receiver@ entry=0x0, event_type= event_type@ entry=0, data=0x5194c8) at kernel/ qcoreapplicatio n.cpp:1552 n::sendPostedEv ents(QObject* , int) (receiver= receiver@ entry=0x0, event_type= event_type@ entry=0) at kernel/ qcoreapplicatio n.cpp:1410 Dispatch( GSource* , GSourceFunc, gpointer) (s=0x536aa0) at kernel/ qeventdispatche r_glib. cpp:271 context_ dispatch (context=0x537390) at /build/ buildd/ glib2.0- 2.44.1/ ./glib/ gmain.c: 3122 context_ dispatch (context= context@ entry=0x537390) at /build/ buildd/ glib2.0- 2.44.1/ ./glib/ gmain.c: 3737 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 context_ iteration (context=0x537390, may_block=1) at /build/ buildd/ glib2.0- 2.44.1/ ./glib/ gmain.c: 3869 rGlib:: processEvents( QFlags< QEventLoop: :ProcessEventsF lag>) (this=0x537620, flags=...) at kernel/ qeventdispatche r_glib. cpp:418 :exec(QFlags< QEventLoop: :ProcessEventsF lag>) (this=this@ entry=0xbedaa27 8, flags=..., flags@entry=...) at kernel/ qeventloop. cpp:204 n::exec( ) () at kernel/ qcoreapplicatio n.cpp:1188 linux-gnueabihf /libc.so. 6
(gdb) bt
#0 0xffffffff in eventfd () at /lib/arm-
#1 0xffffffff in g_wakeup_new () at /build/
#2 0xffffffff in g_main_context_new () at /build/
#3 0xffffffff in cgroup_
#4 0xffffffff in pids_for_appid (appid=
#5 0xffffffff in ubuntu_
#6 0xffffffff in qtmir::
#7 0xffffffff in qtmir::
#8 0xffffffff in qtmir::
#9 0xffffffff in QMetaCallEvent:
#10 0xffffffff in QMetaCallEvent:
#11 0xffffffff in QObject:
#12 0xffffffff in QCoreApplicatio
#13 0xffffffff in QCoreApplicatio
#14 0xffffffff in QCoreApplicatio
#15 0xffffffff in QCoreApplicatio
#16 0xffffffff in QCoreApplicatio
#17 0xffffffff in postEventSource
#18 0xffffffff in g_main_
#19 0xffffffff in g_main_
#20 0xffffffff in g_main_
#21 0xffffffff in g_main_
#22 0xffffffff in QEventDispatche
#23 0xffffffff in QEventLoop:
#24 0xffffffff in QCoreApplicatio
#25 0x0001407e in ()
#26 0xffffffff in __libc_start_main () at /lib/arm-
#27 0x00014590 in _start ()
(gdb) cont
Suspect the leak is in ubuntu-app-launch