Bug 99242 - Suboptimal initialization of accounts-daemon with a large /var/log/wtmp
Summary: Suboptimal initialization of accounts-daemon with a large /var/log/wtmp
Status: RESOLVED MOVED
Alias: None
Product: accountsservice
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium major
Assignee: Matthias Clasen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-01 18:42 UTC by Jan Ziak (http://atom-symbol.net)
Modified: 2018-08-07 09:31 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Dump of the syscall sequence which repeats ~80000 times (1.69 KB, text/plain)
2017-01-01 18:44 UTC, Jan Ziak (http://atom-symbol.net)
Details
Gentoo Linux sys-apps:accountsservice-0.6.43:20170101-181550.log (57.60 KB, text/x-log)
2017-01-03 16:34 UTC, Jan Ziak (http://atom-symbol.net)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Ziak (http://atom-symbol.net) 2017-01-01 18:42:06 UTC
Initialization of accounts-daemon is too heavy on the CPU.

In the case described below, a wtmp of 87 megabytes results in:

 - 2.3 million calls to the Linux kernel
 - File /etc/passwd is open&closed 80000 times

----

# ls -l /var/log/wtmp 
-rw-rw-r-- 1 root utmp 87M Jan  1 19:18 /var/log/wtmp

# perf stat -e raw_syscalls:sys_enter -- /usr/libexec/accounts-daemon
^C
 Performance counter stats for '/usr/libexec/accounts-daemon':
         2,382,413      raw_syscalls:sys_enter

# strace -f -e open /usr/libexec/accounts-daemon |& grep etc/passwd | wc -l
81783

----

Related bugs: #48177
Comment 1 Jan Ziak (http://atom-symbol.net) 2017-01-01 18:44:36 UTC
Created attachment 128706 [details]
Dump of the syscall sequence which repeats ~80000 times
Comment 2 Jan Ziak (http://atom-symbol.net) 2017-01-01 18:49:32 UTC
$ wc -l /etc/passwd                                                                                                                                                                                                                                   
62 /etc/passwd
Comment 3 Ray Strode [halfline] 2017-01-03 14:45:18 UTC
what version of accountsservice are you testing with?

We don't read wtmp since 0.6.43 and there were some other fixes that went in (which I guess you already know about since they're mentioned in the bug you referenced?)
Comment 4 Jan Ziak (http://atom-symbol.net) 2017-01-03 16:33:44 UTC
(In reply to Ray Strode [halfline] from comment #3)
> what version of accountsservice are you testing with?
> 
> We don't read wtmp since 0.6.43 and there were some other fixes that went in
> (which I guess you already know about since they're mentioned in the bug you
> referenced?)

# /usr/libexec/accounts-daemon --version
accounts-daemon 0.6.43

# strace -e open /usr/libexec/accounts-daemon |& grep wtmp
open("/var/log/wtmp", O_RDONLY|O_CLOEXEC) = 8

# readelf -d /usr/libexec/accounts-daemon 
Dynamic section at offset 0x20dc8 contains 32 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libpolkit-gobject-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x405d30
 ....
Comment 5 Jan Ziak (http://atom-symbol.net) 2017-01-03 16:34:43 UTC
Created attachment 128730 [details]
Gentoo Linux sys-apps:accountsservice-0.6.43:20170101-181550.log
Comment 6 GitLab Migration User 2018-08-07 09:31:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/accountsservice/accountsservice/issues/23.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.