Bug 1000364

Summary: accounts-daemon leaks memory on ssh login
Product: [Fedora] Fedora Reporter: nvwarr
Component: accountsserviceAssignee: Matthias Clasen <mclasen>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 19CC: brad, mclasen, schmidt.simon+bugzillaredhatcom
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 16:53:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description nvwarr 2013-08-23 09:41:36 UTC
Description of problem:

accountsservice leaks memory on ssh login

Version-Release number of selected component (if applicable):

accountsservice-0.6.34-1.fc19.x86_64

How reproducible:

always

Steps to Reproduce:
1. login via ssh a lot

Actual results:

memory use of /usr/libexec/accounts-daemon increases significantly (I noticed this when it was at 9 % of the total memory of the system)

Expected results:

accounts-daemon should not leak memory

Workaround:

   sudo systemctl restart accounts-daemon.service

once in a while.

Additional info:

https://bugs.freedesktop.org/show_bug.cgi?id=67700

has two patches which cure two small memory leaks and

https://bugs.freedesktop.org/show_bug.cgi?id=65753

has a patch which seems to cure the big one, though there might still be another small leak somewhere.

The latter one is the important one. When /var/log/wtmp is changed, on_users_monitor_changed (daemon.c), calls queue_reload_users_soon, which schedules a call to reload_users_timeout, which calls reload_users, which calls create_users_hash_table to allocate a hash table. It then replaces the one in daemon->priv->users with that table and calls g_hash_table_destroy on the old one, but since user_finalize (user.c) doesn't free user->login_history, that memory is lost. This happens every time a user logs in and the sum of all the login histories seems to be quite large. So this is rather a big leak.

Comment 1 Brad P. Crochet 2013-11-21 13:50:28 UTC
I can confirm this problem. accounts-daemon had ballooned up to 1G of resident memory. This occurred as a result of a day of ansible usage against localhost. Restarting temporarily releases the memory being use.

Comment 2 Simon S 2013-12-13 17:01:13 UTC
I see 0.6.35, which has the patches mentioned above, is in fedora 20. Will it also be available in fedora 19?

http://cgit.freedesktop.org/accountsservice/tree/src/daemon.c?id=0.6.35#n159
http://cgit.freedesktop.org/accountsservice/tree/src/user.c?id=0.6.35#n2113

Comment 3 nvwarr 2013-12-16 07:17:13 UTC
That would be good, or even just to patch the 0.6.34, as I did back in August. I've been using the patched version since I reported the issue and have experienced no problems since then. Either way, I'm sure users, who don't know how to apply the patches themselves, would like to have one solution or the other.

Comment 4 Fedora End Of Life 2015-01-09 19:33:58 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-02-17 16:53:20 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.