Bug 197242

Summary: xorg take much memory when cover manager loading
Product: [Applications] amarok Reporter: jajaX <jajaxor>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: jajaxor, mikko.cal, qqqqqqqqq9, stuffcorpse
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: valgrind output
debug for cover manager

Description jajaX 2009-06-20 10:50:17 UTC
Version:           2.1.1 (using KDE 4.2.4)
OS:                Linux
Installed from:    Ubuntu Packages

Hi (sorry for my bad english)

same problem like here :

http://amarok.kde.org/forum/index.php/topic,16784.0.html

when cover manager is loading, after 5 mn, my momery state is :

xorg => 1 675 904 ko
amarok => 12772 ko

if I close cover manager, xorg memory is take down.

os : kubuntu 9.04
amarok version : 2.1.1 (same problem with 2.1 ans 2.0.x)
kde version : 4.2.4
Comment 1 jajaX 2009-06-20 11:00:50 UTC
Confirmed here =>

https://bugs.launchpad.net/ubuntu/+source/amarok/+bug/386676
Comment 2 Mikko C. 2009-06-20 11:02:00 UTC
What driver are you using? I suppose radeon?
If so, I opened a bug report about a year ago about this, still nothing:
http://bugs.freedesktop.org/show_bug.cgi?id=16772
Comment 3 jajaX 2009-06-20 15:09:59 UTC
Hi ! 

nop, I have a nvidia video card with nvidia driver 180.44.

X Server Vendor Version : 1.6.0 (10600000)
Comment 4 Mikko C. 2009-06-20 15:35:03 UTC
hm, very interesting... If it's a problem for all the video drivers I'm wondering how it's possible that nobody reported this until now. For all this months I always thought it was a specific radeon problem.
Comment 5 Myriam Schweingruber 2009-07-11 15:57:39 UTC
I have a Radeon card (HD 3650), using the free radeon driver. I can't reproduce this with current trunk, 2.2-SVN, r994561, Kubuntu 9.04, KDE 4.2.95.

Mikko, can you confirm or infirm this bug?
Comment 6 Mikko C. 2009-07-11 16:07:26 UTC
yea still present. I mean, it's probably not an amarok bug but rather Xorg, but I think it would make sense to keep a report open, in case someone else reports it so it can be marked as duplicate.
Comment 7 Myriam Schweingruber 2009-07-11 16:33:02 UTC
Somebody should actually run a valgrind memory test on this, so we could get some more information on where that memory leak is located. Here are instructions on how to run a valgrind test:

valgrind --log-file=$HOME/amarok.valgrind.output --leak-resolution=high --leak-check=full --num-callers=40 -- amarok -m -d --nofork

Be careful to not do anything else when testing but the task you want to test for a leak, then quite the application. Beware, the output will be quite long, so you might have to compress it with bzip2 before attaching it here.

Thanks for anybody who can spare some time testing this :)
Comment 8 Andreas Mair 2009-07-20 14:01:11 UTC
Created attachment 35481 [details]
valgrind output
Comment 9 Andreas Mair 2009-07-20 14:02:31 UTC
Comment on attachment 35481 [details]
valgrind output

Hi,

this happens here too. Using Gentoo KDE 4.2.4, Amarok 2.1.1, Xorg 1.6.2 (also happened using 1.5.3) and Intel video drivers 2.7.1.

I also cannot cancel the cover scanner!

Please find attached the requested valgrind (and console) output.

Kind regards,
Andreas
Comment 10 Mikko C. 2009-07-20 14:14:23 UTC
This is a Xorg leak, not amarok, valgrind is useless on amarok.
A year ago I did a valgrind check on Xorg (see: http://bugs.freedesktop.org/show_bug.cgi?id=16772 ) but the developers said it wasn't useful so asked for a check with memprof.
Problem is memprof isn't maintained anymore and doesn't even compile on amd64.
Also you need two PCs, one to run X and amarok, and the other for memprof and ssh. I never managed to get the log, but maybe someone with more experience will. Please consider posting such info on b.f.o and not here. This bug is only to gather people with the same problem and redirect them to b.f.o where this bug belongs.
Comment 11 Myriam Schweingruber 2009-07-20 15:21:06 UTC
Mikko, if it's indeed the Amarok Cover manager that triggers the leak, we might well find some answer in the valgrind output, so how would this be useless?. Did your valgrind output you reported to Xorg used the same parameters?

BTW, there seems to have been a memory leak in the early KDE 4.3 RC2 packages of about 10 days ago, which is fixed upstream by KDE according to Thiago, maybe have a look at that?
Comment 12 Mikko C. 2009-07-20 15:38:44 UTC
(In reply to comment #11)
> Mikko, if it's indeed the Amarok Cover manager that triggers the leak, we might
> well find some answer in the valgrind output, so how would this be useless?.
> Did your valgrind output you reported to Xorg used the same parameters?
> 

I can't remember because it was over a year ago, but I think it was fine, just not useful for this specific leak. About amarok, I doubt that it has any fault if Xorg leaks memory, but I can surely be wrong.

> BTW, there seems to have been a memory leak in the early KDE 4.3 RC2 packages
> of about 10 days ago, which is fixed upstream by KDE according to Thiago, maybe
> have a look at that?

I'll update my kde and try, but really I think this is not amarok/kde's fault.
And even if a valgrind log on amarok could show some problem, it should be reported on b.f.o imho.
Comment 13 jajaX 2009-07-21 10:35:21 UTC
Created attachment 35508 [details]
debug for cover manager
Comment 14 jajaX 2009-07-21 10:36:48 UTC
hi !

see my attachment ;)
Comment 15 Myriam Schweingruber 2009-07-22 14:30:39 UTC
*** Bug 201047 has been marked as a duplicate of this bug. ***
Comment 16 Myriam Schweingruber 2009-07-23 13:04:32 UTC
May be a hint: these memory losses seem to happen only when something is downloaded from the web, be this Cover pictures or pictures from flickr as in bug 201047.
Comment 17 Mikko C. 2009-07-23 13:27:20 UTC
Not for me. All my covers are stored in my collection, nothing fetched from the web.
Comment 18 jajaX 2009-07-23 15:42:43 UTC
same thing for me
Comment 19 jajaX 2009-07-28 22:54:34 UTC
Hi ! (sorry for my bad english)

Mikko C. =>

which is the format you uses for cover ?

personnaly, I use jpeg, png and gif.
Comment 20 Mikko C. 2009-07-29 09:50:47 UTC
I also have png jpg mostly.
I guess few bmp and gif too.
Comment 22 Myriam Schweingruber 2009-08-13 21:09:15 UTC
OK, I tested this again today with the current Amarok 2.2-git. 
Blank database, opened cover manager, locale set to international and let it download the covers for 529 albums:
X memory usage on start: 14.4%
X memory usage once the download terminated: 20.3%
After closing the cover manager: 16.3%
Amarok's memory usage doesn't change at all.
Comment 23 jajaX 2009-08-13 22:34:32 UTC
Hi ! (sorry for my bad english)

I make some test too.

I use amarok 2.1.1.
I have got, in my collection, two folders  :
- "compilations" => 3199 tracks in 271 albums.
- "albums" => 10 991 tracks in ??? albums.

with only "compilations", the loading is fine for the cover manager.
with only "albums", the loading load.... my physical memory and swap load too.

with amarok lauch in konsole, I can see that :

"Corrupt JPEG data: premature end of data segment"
 
and

"  Resource id:  0x4403a2e                                  
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 72 (X_PutImage)                            
  Resource id:  0x4403a2e                                  
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 72 (X_PutImage)                            
  Resource id:  0x4403a2e                                  
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 72 (X_PutImage)                            
  Resource id:  0x4403a2e                                  
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 72 (X_PutImage)                            
  Resource id:  0x4403a2e                                  
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 72 (X_PutImage)                            
  Resource id:  0x4403a2e                                  
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 72 (X_PutImage)...."

like this bug :
http://bugs.kde.org/show_bug.cgi?id=127999

and for finish

"....
X Error: RenderBadPicture (invalid Picture parameter) 169
  Extension:    151 (RENDER)
  Minor opcode: 5 (RenderChangePicture)
  Resource id:  0x4403b29
X Error: BadGC (invalid GC parameter) 13
  Major opcode: 60 (X_FreeGC)
  Resource id:  0x4403b29
X Error: BadGC (invalid GC parameter) 13
  Major opcode: 60 (X_FreeGC)
  Resource id:  0x4403b29
X Error: RenderBadPicture (invalid Picture parameter) 169
  Extension:    151 (RENDER)
  Minor opcode: 8 (RenderComposite)
  Resource id:  0x4403b29
amarok: Fatal IO error: client killed"

my two folder are in ext3 partition
Comment 24 jajaX 2009-08-14 19:00:06 UTC
Hi !!

for to sort back my collection, and covers, I come back to amarok 1.4.10.

I will try amarok 2.2 when is comming ;)
Comment 25 Mark Kretschmann 2009-10-07 10:17:44 UTC
Closing the report than. We can't reproduce it with 2.2. Neither can anyone else, apparently.

Also it may possibly be a x.org or driver bug.
Comment 26 Mikko C. 2009-10-07 10:37:08 UTC
Reopening as requested, but keep in mind this might not be an Amarok bug.
See this for the Xorg bug I opened: http://bugs.freedesktop.org/show_bug.cgi?id=16772
Comment 27 Mikko C. 2009-10-17 10:42:31 UTC
this is fixed in 2.2.1.
See bug #210454 for more details
Comment 28 jajaX 2009-10-17 12:23:49 UTC
Hi !

nice ! nice !!! great job !!

big thanks ;)