Bug 244995 - hald is leaking memory with apm
Summary: hald is leaking memory with apm
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: hal
Version: 8
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: David Zeuthen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-06-20 13:42 UTC by nvwarr
Modified: 2013-03-06 03:51 UTC (History)
6 users (show)

Fixed In Version: 20080607-2.fc8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-07-09 21:45:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch adding a call to g_slist_free (243 bytes, patch)
2007-06-20 13:42 UTC, nvwarr
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
FreeDesktop.org 12588 0 None None None Never

Description nvwarr 2007-06-20 13:42:07 UTC
Description of problem:

When hald is running on a system with apm, it leaks memory. I noticed this on a
system where hald was using 85 % of the memory (compared to 0.8 % when freshly
started).

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

hal-0.5.9-8.fc7

How reproducible:

Always

Steps to Reproduce:
1. Start hald
2. Wait several hours
3. Initially, the memory usage doesn't grow, but after a while it starts growing
 significantly.
  
Actual results:
A memory leak

Expected results:
No memory leak

Additional info:
In hald/linux/apm.c in the function apm_poll,
hal_device_store_match_multiple_key_value_string is called. It returns a pointer
to a GSList, which is generated with calls to g_slist_prepend in that function.

This singly-linked list should be freed once it has been used in apm_poll, but
this is not the case.

I propose to add a call to g_slist_free at the end of apm_poll to fix this leak.

This is quite a big leak, because apm_poll is called every 2 seconds. It brings
my system to its knees in a few days. However, I suspect it is not the only one.
handle_match in device_info.c looks suspicious, where it deals with siblings.

Comment 1 nvwarr 2007-06-20 13:42:07 UTC
Created attachment 157464 [details]
patch adding a call to g_slist_free

Comment 2 Matthias Clasen 2007-09-27 17:54:29 UTC
Looks like an easy fix, that is still missing in upstream git. David ?

Comment 3 Tomasz Ostrowski 2007-09-28 15:15:56 UTC
I can confirm that this patch fixes this bug on my computer. After applying it
hald memory usage does not grow anymore and it was growing over 200MB/month before.

Comment 4 Matthias Clasen 2007-10-01 23:31:03 UTC
A more comprehensive leak fix was recently posted on the hal list:
http://lists.freedesktop.org/archives/hal/2007-September/009642.html

Comment 5 Thomas Müller 2007-12-12 16:24:48 UTC
Is a fix for this leak included in hal-0.5.10-1.fc8?

Because that's the version I'm using and I have a similar (the same?) problem.

Comment 6 Thomas Müller 2007-12-22 08:26:08 UTC
I just checked the source code of hal-0.5.10-1.fc8, and the fix is not included.

However, the fix mentioned in comment #4 was added to the upstream repository at
2007-10-17.
http://gitweb.freedesktop.org/?p=hal.git;a=commit;h=1491787fdf29fd77e4cbd13af70434ee3e7032ee

Could someone build and release an update with at least this fix included?

Comment 7 Thomas Müller 2008-01-31 07:59:33 UTC
ping? :)

Comment 8 Bug Zapper 2008-05-14 13:12:58 UTC
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

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 prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 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 please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

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. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 9 Richard Hughes 2008-05-30 11:32:54 UTC
Thomas is this still an issue with F9? If so, please email the HAL mailing list
with your patch and I'll make sure itgets reviewed. Thanks.


Comment 10 nvwarr 2008-05-31 08:01:02 UTC
(In reply to comment #9)  
> Thomas is this still an issue with F9? If so, please email the HAL mailing  
list  
> with your patch and I'll make sure itgets reviewed. Thanks.  
>   
  
The computer I had which needed apm, which caused me to spot this bug has  
died, so I can't test anything, but looking at the source code from:  
hal-0.5.11-0.7.rc2.fc9.src.rpm  
it would seem that the missing g_slist_free which my patch added has been  
integrated into that release. So I expect that the problem is fixed once and  
for all and there's certainly no need to review my one-line patch as it seems  
to have already been included in the mainstream hal distribution.  
  
Maybe Thomas can confirm if this works for him too.  

Comment 11 Tomasz Ostrowski 2008-06-16 08:57:03 UTC
But Fedora 8 is affected badly. Could you, please, reopen this bug for Fedora 8.
And release an errata package?

Comment 12 Richard Hughes 2008-06-16 11:58:35 UTC
I'll try to build an F8 package now.

Comment 13 Fedora Update System 2008-06-16 13:29:53 UTC
hal-0.5.10-3.fc8 has been submitted as an update for Fedora 8

Comment 14 Fedora Update System 2008-06-16 23:32:22 UTC
hal-0.5.10-3.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update hal'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-5380

Comment 15 Bug Zapper 2008-06-17 01:39:48 UTC
Fedora 7 changed to end-of-life (EOL) status on June 13, 2008. 
Fedora 7 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.

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

Comment 16 Alex Lancaster 2008-06-17 08:35:52 UTC
Re-opening and switching component to F-8, as this bug still exists in F-8 and
should be closed by bodhi as CURRENTRELEASE, not CANTFIX.

Comment 17 Alex Lancaster 2008-06-17 08:39:39 UTC
Also there appears to have been some maintainer miscommunication as Richard
Hughes obsoleted the existing updates-testing update (originally pushed by dcbw):

https://admin.fedoraproject.org/updates/F8/FEDORA-2008-5137

by pushing a new update for hal:

https://admin.fedoraproject.org/updates/F8/FEDORA-2008-5380

but crucially, he didn't also append the hal-info-20080607-1.fc8 from dcbw's
previous update to the new update, effectively obsoleting the hal-info update at
the same time which is necessary to fix a bug in pilot link (bug #280251 comment
#170).

Comment 18 Richard Hughes 2008-06-17 14:16:30 UTC
Can I just bump and rebuild hal-info and push to stable?

Comment 19 Kevin R. Page 2008-06-18 13:37:43 UTC
(In reply to comment #18)
> Can I just bump and rebuild hal-info

Yes, presuming you mean pull from current freedesktop git. We need the hal-info
you (accidentally?) obsoleted back. More recent is fine.

Comment 20 Richard Hughes 2008-06-19 03:01:33 UTC
>We need the hal-info you (accidentally?) obsoleted

Sure, I didn't know a hal-info was staged -- apologies. I'll rebuild hal-info as
soon as I'm back from the summit.

Comment 21 Fedora Update System 2008-06-19 16:13:08 UTC
hal-info-20080607-2.fc8 has been submitted as an update for Fedora 8

Comment 22 Fedora Update System 2008-06-20 19:07:18 UTC
hal-info-20080607-2.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update hal-info'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-5475

Comment 23 Kevin R. Page 2008-07-07 16:58:59 UTC
The hal/hal-info combination in updates-testing seems to have triggered another
bug for some users - bug #452701 - which could do with some attention.

Will the bad karma in bodhi block this update because of it?

I've found a debian patch that looks like the appropriate fix and referenced it
in bug #452701.

(Bug #280251 has been blocked on a hal update - or even just packager
communication! - for nigh on 5 months now, sadly)

Comment 24 Fedora Update System 2008-07-09 21:45:40 UTC
hal-info-20080607-2.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 25 Fedora Update System 2008-07-09 21:49:22 UTC
hal-0.5.10-3.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.