aMule Forum

English => aMule Help => Topic started by: Ezeltje on March 20, 2006, 12:33:15 AM

Title: memory usage
Post by: Ezeltje on March 20, 2006, 12:33:15 AM
I downloaded v2.1.1 and compiled it this afternoon. After running ~3 1/2 hours, amule was using 1148m virtual, 784m shared memory, according to top. If there is any way I can help track this problem down, please let me know.
Title: Re: memory usage
Post by: Kry on March 20, 2006, 02:53:14 AM
amule --version
Title: Re: memory usage
Post by: Ezeltje on March 20, 2006, 05:18:45 PM
$ ./amule --version
aMule 2.1.1 using wxGTK2 v2.6.2 (Unicoded) (OS: Linux)
Title: Re: memory usage
Post by: Kry on March 20, 2006, 08:28:41 PM
Do you use EC?
Title: Re: memory usage
Post by: Ezeltje on March 20, 2006, 08:52:58 PM
You mean External Connections? Yes, for quite some time.
Title: Re: memory usage
Post by: Ezeltje on March 21, 2006, 12:35:57 AM
Update: I've had 2.1.1 running now for ~7 hours, and memory usage appears to have stabilized at 106m RES and 147m VIRT. Apparently, the mem leak only happens under very specific circumstances...
Title: Re: memory usage
Post by: Kry on March 21, 2006, 05:27:26 AM
There is a potentially huge memleak on EC I fixed yesterday, will be ok on 2.1.2 (which would be.... soon)
Title: Re: memory usage
Post by: Ezeltje on April 06, 2006, 05:44:07 PM
Quote
Originally posted by Kry
There is a potentially huge memleak on EC I fixed yesterday, will be ok on 2.1.2 (which would be.... soon)

Has this made it into the CVS version? I am running the 1 April tarball and just now the memory leak once again completely choked my system; it became unresponsive and I had to hit the reset button. Although I had EC enabled, I wasn't using it, but for the time being I have disabled it.

I really like amule -- but not when it nukes my system. ;(
Title: Re: memory usage
Post by: Kry on April 06, 2006, 06:02:26 PM
aMule can't nuke your system. Which wx are you using?
Title: Re: memory usage
Post by: Ezeltje on April 06, 2006, 06:09:35 PM
Never mind. it appears that it was a CUPS program called footmatic-rip that was choking my system. Problem was that I couldn't open top in time to find out what the culprit was... Sorry for the false alarm.
Title: Re: memory usage
Post by: Kry on April 06, 2006, 06:12:46 PM
Told ya, told ya....
Title: not so fast...
Post by: Ezeltje on April 10, 2006, 12:41:23 PM
My system spontaneously started thrashing again this morning and this time it did in fact turn out to be caused by amule. Although the system became unresponsive, I was finally able to shutdown X with ctrl-alt-backspace and log into a failsafe terminal. Here is the output from top which I saved to disk:

Code: [Select]
$ cat toplog.txt

top - 12:19:25 up 1 day, 11:41,  3 users,  load average: 1.69, 9.37, 12.31
Tasks:  95 total,   1 running,  94 sleeping,   0 stopped,   0 zombie
Cpu(s): 20.6% us,  1.9% sy,  0.0% ni,  0.0% id, 77.5% wa,  0.0% hi,  0.0% si
Mem:   1035176k total,  1020624k used,    14552k free,      620k buffers
Swap:  1020116k total,   534784k used,   485332k free,    10812k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3049 jrb       18   0 1339m 899m 2492 D 21.1 89.0 262:51.90 amule
  157 root      15   0     0    0    0 S  0.3  0.0   0:37.54 kswapd0
 2347 root      15   0     0    0    0 S  0.3  0.0   0:10.13 nfsd
    1 root      16   0  1992  104   80 S  0.0  0.0   0:01.22 init
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.48 ksoftirqd/0
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    4 root      10  -5     0    0    0 S  0.0  0.0   0:00.32 events/0
    5 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper
    6 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
    8 root      10  -5     0    0    0 S  0.0  0.0   0:00.62 kblockd/0
    9 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid
  100 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khubd
  158 root      18  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0
  245 root      10  -5     0    0    0 S  0.0  0.0   0:00.02 kseriod
  320 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 kpsmoused
  336 root      10  -5     0    0    0 S  0.0  0.0   0:00.02 ata/0
  340 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0

As you can see, amule was still running and using a catastrophic amount of memory, nearly 900M on a 1 GB machine. For some reason it had not responded to the Gnome logout and I could only terminate it with killall -9.

FWIW: amule had been running about 36 hours. Yes, I am sharing a lot of files.

At this point, I don't think it has anything to do with ext connections; I had that function disabled and amuleweb was not running. This is the 1 April CVS with wxGTK-2.6.2-5.fc5.

Let me know if I can supply any additional information...
Title: once again
Post by: Ezeltje on April 13, 2006, 08:27:09 PM
This time amule ran fine for about three days, then suddenly started gobbling up memory. I captured the top output in a terminal window on my laptop:
Code: [Select]
$ top

top - 20:05:51 up 4 days, 19:28,  5 users,  load average: 14.24, 7.73, 4.17
Tasks: 168 total,   1 running, 166 sleeping,   0 stopped,   1 zombie
Cpu(s):  1.6% us, 10.9% sy,  0.0% ni,  0.0% id, 87.4% wa,  0.0% hi,  0.0% si
Mem:   1035176k total,  1022996k used,    12180k free,      548k buffers
Swap:  1020116k total,  1020116k used,        0k free,    21536k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
22470 jrb       17   0 1218m 682m 2436 D  1.0 67.5 611:06.59 amule
32682 jrb       16   0  215m  63m 3412 D  0.5  6.3   0:28.74 firefox-bin
23291 jrb       16   0  299m  49m 1992 D  0.5  4.9  10:23.91 thunderbird-bin
22155 root      16   0  160m  30m 1788 D  1.3  3.0 905:14.19 Xorg
[...]
Although the desktop box became unresponsive, I fortunately got to my laptop in time to kill amule via this terminal window.

I am the only one having this problem???
Title: Re: memory usage
Post by: Kry on April 13, 2006, 09:09:26 PM
Seems so. weird.
Title: Re: memory usage
Post by: Ezeltje on April 13, 2006, 09:22:58 PM
Could there possibly be something in the 2.1 kad code? As I mentioned earlier in this thread, I never had this problem with 2.03, which I ran for many weeks, sometimes months at a time.
Title: Re: memory usage
Post by: advantz on April 18, 2006, 03:49:16 AM
Code: [Select]
 08:48:15  up 3 days,  6:21,  1 user,  load average: 0.95, 0.93, 0.91
67 processes: 64 sleeping, 3 running, 0 zombie, 0 stopped
CPU0 states:   5.1% user   5.0% system    0.0% nice   0.0% iowait  89.2% idle
CPU1 states:   2.2% user  28.4% system    0.0% nice   0.0% iowait  68.2% idle
Mem:  2032076k av, 2019084k used,   12992k free,       0k shrd,   62884k buff
                   1431248k actv,  172832k in_d,   43744k in_c
Swap: 1052248k av,  196212k used,  856036k free                 1626792k cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
 7279 admin     15   0 53224  51M  3252 R     9.7  2.6  21:46   0 amuled

I'm running 100 files, phew takes a lot of cpu resources, but better than torrent

running amule 2.1.1-2 w/ gtk 2.6.3
daemon better than gui then...
Title: Re: memory usage
Post by: phoenix on April 18, 2006, 12:42:14 PM
Code: [Select]
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921  9.1 12.1 196540 125496 pts/6   Sl   21:54   3:54 trunk/src/amule --only-chuck-norris-would-stop-me
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921 10.8 12.1 196540 125960 pts/6   Sl   Apr17  16:06 trunk/src/amule --only-chuck-norris-would-stop-me
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921 10.8 12.1 196540 125968 pts/6   Sl   Apr17  16:25 trunk/src/amule --only-chuck-norris-would-stop-me
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921 11.0 12.1 196540 125968 pts/6   Sl   Apr17  18:08 trunk/src/amule --only-chuck-norris-would-stop-me
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921 17.2 12.1 196540 125992 pts/6   Sl   Apr17  97:22 trunk/src/amule --only-chuck-norris-would-stop-me
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921 17.5 12.1 196540 126068 pts/6   Dl   Apr17 101:06 trunk/src/amule --only-chuck-norris-would-stop-me
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
myuser 18921 17.5 12.1 196540 126068 pts/6   Rl   Apr17 101:13 trunk/src/amule --only-chuck-norris-would-stop-me
...
aMule CVS rev. 6702 has been running for 9:45 h
amuleuser is connnnected to xxxxxxxxxxxxxxx [XXX.XXX.XXX.XXX:XXXX] with HighID | Kad: ok
Total Download: 378.82 Gb, Upload: 193.71 Gb
Session Download: 1.42 Gb, Upload: 628.63 Mb
Download: 209.2 kB/s, Upload: 24.0 kB/s
Sharing: 1190 file(s), Clients on queue: 4999
This is the latest CVS code, aMule monolithic. Memory usage seems stable. 50 files in dl queue.
Title: Re: memory usage
Post by: Ezeltje on May 04, 2006, 11:23:21 PM
Ok, back again. I am now running today's CVS. How do you get those amule stats on the command line?
Title: Re: memory usage
Post by: phoenix on May 04, 2006, 11:26:17 PM
Use a program named cas. You must configure aMule with --enable-cas or something like this.
Title: Re: memory usage
Post by: Ezeltje on May 04, 2006, 11:54:43 PM
Here is my cas output:
Code: [Select]
aMule CVS Thu May  4 07:02:02 CEST 2006 has been running for 1:14 h
amuleuser is connnnected to XXXXXXXXXX [xxxxxxxxxxxxx] with HighID | Kad: ok
Total Download: 652.67 Gb, Upload: 2.05 Tb
Session Download: 37.35 Mb, Upload: 334.23 Mb
Download: 6.4 kB/s, Upload: 80.0 kB/s
Sharing: 1371 file(s), Clients on queue: 4817
Any other information I can supply you with?
Title: Re: memory usage
Post by: phoenix on May 05, 2006, 05:36:16 AM
Well, cas does not give us any interesting information, I had posted it only to show my uptime.

You said you have problems with memory leaks. I assume you use CVS code, right? Post here:
$ amule --version

And with aMule running, with one hour intervals, run
$ ps u -C amule

So that we can compare the memory usage report.

Cheers!
Title: memory usage
Post by: todo_basura on May 06, 2006, 02:19:15 PM
seems same problem.

Starts with 10.5 % mem usage and when it reaches +- 60% i can't preview files

If i close and restart amule then all is ok.

suse system. Amule and wxGTK2 compiled as says in amule wiki "compile and install amule from source"

amule --version :

aMule 2.1.1 using wxGTK2 v2.6.3 (Unicoded) (OS: Linux)

"ps u -C amule" with a 30 minutes interval :

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.2 37.6 418948 389656 ?       Sl   May04 265:09 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.2 37.8 421648 392436 ?       Sl   May04 269:12 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.2 38.7 430844 401348 ?       Sl   May04 278:56 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.2 38.8 431836 402516 ?       Rl   May04 283:05 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.2 39.1 434892 405524 ?       Sl   May04 287:56 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.1 39.3 437536 408104 ?       Sl   May04 292:29 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.1 39.7 441256 412112 ?       Sl   May04 296:54 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.1 40.1 444980 415836 ?       Sl   May04 301:05 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.0 40.5 448820 419820 ?       Sl   May04 304:58 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.0 40.9 453528 424520 ?       Sl   May04 309:20 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.0 41.3 458016 428524 ?       Sl   May04 313:31 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 16.0 41.8 462756 433468 ?       Sl   May04 318:07 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.9 42.1 466188 436884 ?       Sl   May04 322:18 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.9 42.5 470356 440924 ?       Sl   May04 326:41 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.9 42.8 473868 444504 ?       Sl   May04 330:38 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.8 43.2 478060 448612 ?       Sl   May04 334:29 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.8 43.7 482364 453308 ?       Sl   May04 338:39 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.8 44.2 487152 458008 ?       Sl   May04 343:16 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.8 44.5 490688 461680 ?       Sl   May04 347:47 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 44.8 494292 465192 ?       Sl   May04 351:48 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 45.3 499528 470156 ?       Sl   May04 356:17 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 45.7 503100 473812 ?       Sl   May04 360:36 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 46.1 507948 478660 ?       Sl   May04 365:03 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 46.6 513140 483816 ?       Sl   May04 369:44 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 47.1 518012 488888 ?       Sl   May04 374:19 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 47.6 522692 493396 ?       Sl   May04 379:13 amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
basura   30923 15.7 48.0 526816 497728 ?       Sl   May04 383:37 amule


any help?
Title: Re: memory usage
Post by: Kry on May 06, 2006, 02:28:14 PM
That's really weird.

Wait, do you use EC?
Title: Re: memory usage
Post by: todo_basura on May 06, 2006, 03:09:20 PM
EC? --> external conections?

No, i do not use external conections
Title: Re: memory usage
Post by: phoenix on May 09, 2006, 03:57:13 AM
Yeah, definetly sucking memory...
Can you compile and try a CVS tarball?
Title: update: ok here
Post by: Ezeltje on May 16, 2006, 03:01:39 PM
Hi all,

Since compiling the 4 May CVS, I have not seen the memory leak. In the beginning, it crashed a couple of times after running ~24 hours, but I now have an uptime of six days:

Code: [Select]
$ cas
aMule CVS Thu May  4 07:02:02 CEST 2006 has been running for 6 D 00 h
amule-user is connnnected to xxxxxxxxxxx [XXXXXXXXXXXXX] with HighID | Kad: ok
Total Download: 658.58 Gb, Upload: 2.12 Tb
Session Download: 1.41 Gb, Upload: 38.67 Gb
Download: 0.0 kB/s, Upload: 79.9 kB/s
Sharing: 1383 file(s), Clients on queue: 4997
It appears the problem has been fixed.

Thanks everyone. aMule is awesome!
Title: RE: update: ok here
Post by: Ezeltje on June 06, 2006, 05:47:23 PM
Alas, I encountered another memory leak today, running the 2.1.2 code, with EC enabled.

Code: [Select]
Tue Jun  6 17:25:02 CEST 2006
aMule 2.1.2 has been running for 1 D 00 h
amule-user is connnnected to XXXXXXXXXXXX [xxxxxxxxxxxxxx] with HighID | Kad: ok
Total Download: 668.75 Gb, Upload: 2.22 Tb
Session Download: 2.10 Gb, Upload: 6.76 Gb
Download: 14.6 kB/s, Upload: 69.8 kB/s
Sharing: 1417 file(s), Clients on queue: 5000

At Tue Jun  6 17:25:02 CEST 2006:

Code: [Select]
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xxxxx    32372 19.1 11.0 238288 114760 ?       Sl   Jun05 286:00 /usr/local/bin/amule

Five minutes later:
Code: [Select]
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xxxxx    32372 19.3 70.9 1094492 734064 ?      Rl   Jun05 289:37 /usr/local/bin/amule

top indicated 773M resident memory, 1240M shared before I killed it.

Please don't shoot the messenger :(
Title: memory usage
Post by: walkin on June 07, 2006, 08:57:27 PM
Ezeltje,
you said something about 2.0.3. How you comment this ?

This is aMule 2.0.3 using wxGTK2 v2.6.1 (Unicoded) based on eMule.
Running on Linux 2.6.12-10-386 i686

top - 20:30:12 up 11 days, 2 min,  2 users,  load average: 0.09, 0.19, 0.17
Tasks:  89 total,   1 running,  88 sleeping,   0 stopped,   0 zombie
Cpu(s):  4.3% us,  1.0% sy,  0.0% ni, 94.4% id,  0.0% wa,  0.0% hi,  0.3% si
Mem:    776552k total,   767108k used,     9444k free,    11460k buffers
Swap:   499928k total,   418684k used,    81244k free,   149468k cached

  PID     USER      PR  NI   VIRT    RES   SHR   S   %CPU   %MEM    TIME+     COMMAND
28310   xxxxxx    16    0    838m    441m  11m   S    3.3          58.2     334:50.32    amule
27984   root        15    0    123m      35m 7860   S    1.3            4.7     195:57.20    Xorg
28146   xxxxxx    16    0    104m      37m  13m   S    0.3            4.9         5:25.08    nautilus

Keep on 8o
Title: Re: memory usage
Post by: thedude0001 on June 09, 2006, 06:02:41 AM
walkin: There's a huge memleak in wx < 2.6.2 and I'm not sure if the workaround in amule was added before or after 2.0.3. Try upgrading wx & amule.
Title: Re: memory usage
Post by: Ezeltje on August 04, 2006, 09:22:15 PM
The mem leak snuck up on me again a few days ago (I am running the 20060724 CVS), so I wrote a little script to prevent amule from choking my system when the memleak occurs:

Code: [Select]
#!/bin/bash
#
amule_max_mem="500000"
sleep_interval="60"

while :
        do
        amule_virtual_mem=`ps u -C amule | tail -1 | awk '{print $5}'`
        if [ $amule_virtual_mem -gt $amule_max_mem ]; then
                killall amule
        fi
        sleep $sleep_interval
        done

This script checks once a minute how much virtual memory amule is using and kills if it starts using more than 500MB (on my system, it tends to use around 280MB under normal circumstances).

If anyone else is encountering the mem leak, I hope they will find this script useful.
Title: Re: memory usage
Post by: icoming on September 09, 2006, 10:12:58 AM
Quote
Originally posted by thedude0001
walkin: There's a huge memleak in wx < 2.6.2 and I'm not sure if the workaround in amule was added before or after 2.0.3. Try upgrading wx & amule.
I think amule v2.1.3 has the memory leak too.
The wx I use is 2.7.0-1.
Title: Re: memory usage
Post by: Ezeltje on September 09, 2006, 10:24:23 AM
Quote
Originally posted by icoming
I think amule v2.1.3 has the memory leak too.
Yep, I still encounter it every few days...
Title: Re: memory usage
Post by: icoming on September 10, 2006, 12:28:09 PM
How to disable external conections?
Actually, I don't know whether it has been enabled, but I want a try.
Title: Re: memory usage
Post by: GonoszTopi on September 10, 2006, 02:38:56 PM
Preferences > Remote Controls > Accept external connections

or

edit amule.conf, in the section [ExternalConnect] set AcceptExternalConnections=0
Title: Re: memory usage
Post by: icoming on September 11, 2006, 03:14:50 AM
Then I haven't enabled it.
aMule must have some other functions which cause the memory leak.
Which latest version of aMule has not been report having the memory leak?
Title: Re: memory usage
Post by: Ezeltje on September 11, 2006, 05:37:10 AM
Quote
Originally posted by icoming
aMule must have some other functions which cause the memory leak.
Which latest version of aMule has not been report having the memory leak?

v.2.0. It appears to have been introduced in v.2.1.1. I thought the addition of kad might be responsible for it, but I encounter the memleak even with kad turned off.
Title: Re: memory usage
Post by: icoming on September 11, 2006, 06:44:04 PM
I think aMule 2.1.3 has another problem.
aMule runs for a while, and it uses the most resources in my computer.
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
12368 zhengda   25   0  330m 247m  16m R 99.2 50.0  18:15.34 amule
 4587 root       5 -10 56368  34m 7428 S  0.3  7.0  25:22.79 XFree86
Title: I'm seeing the mem leak too, 2.1.3, Debian Sarge
Post by: regarding on September 24, 2006, 03:31:22 AM
I've noticed my system becoming really sluggish and 100% out of memory as shown by GNOME
System Monitor.  Never knew what program was doing it til today.  I was able to ssh in from another
machine and run "top", showing 1400+ Mbyte amule process.  When I created a new swapfile and
did "swapon" to it, within seconds amule had eaten another 64 megs.  I added two more 128 meg
swapfiles and those got eaten too.  But I was able to kill -ILL the amule process, hoping to get
a core file or something that would allow this to be debugged.

Unfortunately, amule contains some silly signal catcher which prevents it from dumping core --
instead I got this output:

$ kill -ILL %3
$
--------------------------------------------------------------------------------
A fatal error has occurred and aMule has crashed.
Please assist us in fixing this problem by posting the backtrace below in our
'aMule Crashes' forum and include as much information as possible regarding the
circumstances of this crash. The forum is located here:
    http://forum.amule.org/board.php?boardid=67
If possible, please try to generate a real backtrace of this crash:
    http://www.amule.org/wiki/index.php/Backtraces

----------------------------=| BACKTRACE FOLLOWS: |=----------------------------
Current version is: aMule 2.1.3 using wxGTK2 v2.6.3 (Unicoded)
Running on: Linux 2.6.11-1-k7-smp i686

[then a lot of BEEPs, as if control-G was being output many times...]

$ jobs
[3]+  Running                 amule &  (wd: ~)
$ kill -ILL %3
$
--------------------------------------------------------------------------------
A fatal error has occurred and aMule has crashed.
Please assist us in fixing this problem by posting the backtrace below in our
'aMule Crashes' forum and include as much information as possible regarding the
circumstances of this crash. The forum is located here:
    http://forum.amule.org/board.php?boardid=67
If possible, please try to generate a real backtrace of this crash:
    http://www.amule.org/wiki/index.php/Backtraces

----------------------------=| BACKTRACE FOLLOWS: |=----------------------------
Current version is: aMule 2.1.3 using wxGTK2 v2.6.3 (Unicoded)
Running on: Linux 2.6.11-1-k7-smp i686

[2] ?? in amule [0x8083d46]
[3] wxFatalSignalHandler in /usr/lib/libwx_baseu-2.6.so.0[0xb75b66c8]
[4] ?? in [0xffffe420]
[5] wxMilliSleep(unsigned long) in /usr/lib/libwx_baseu-2.6.so.0[0xb75b4705]
[6] wxThread::Sleep(unsigned long) in /usr/lib/libwx_baseu-2.6.so.0[0xb75ac84f]
[7] ?? in amule [0x8117df4]
[8] wxThreadInternal::PthreadStart(wxThread*) in /usr/lib/libwx_baseu-2.6.so.0[0xb75ac1c6]
[9] wxPthreadStart in /usr/lib/libwx_baseu-2.6.so.0[0xb75ac03f]
[10] ?? in /lib/tls/libpthread.so.0 [0xb7fcab63]
[11] __clone in /lib/tls/libc.so.6[0xb734d18a]


--------------------------------------------------------------------------------
[3]+  Aborted                 amule  (wd: ~)

Note that I had to kill it twice to get any meaningful output.

This bug only happens to me every few weeks, it seems.  I use both kad and ed2k.
I had external connections enabled, but wasn't using it (it was there for running amule-daemon,
but I discovered amule-daemon didn't support double clicking on a file to see what peers have
it, which I use a lot, so I stopped using it).
Title: RE: I'm seeing the mem leak too, 2.1.3, Debian Sarge
Post by: Ezeltje on September 25, 2006, 11:31:30 AM
Quote
Originally posted by regarding
This bug only happens to me every few weeks

You are lucky then. The longest uptime I have seen since 2.1 is 12 days. Sometimes the memleak pops up after just 4 or 5 hours but on average it is about two days.
Title: Re: memory usage
Post by: Ezeltje on December 08, 2006, 01:35:10 AM
Hi all,

I hate to nag, but is there any chance this bug will ever be fixed?

I just encountered it again this evening; in the course of about eight minutes, aMule went from around 100M/240M to 680M/1648M (real/virtual) memory use, thereby bringing my system to a halt and requiring a reboot. These are entries from a log updated every two minutes:

Code: [Select]
Fri Dec  8 00:42:02 CET 2006
aMule CVS Sun Dec  3 07:01:55 CET 2006 has been running for 4:21 h
xxxxxxx is connnnected to XXXXXXXXXXXXXX  [x.x.x.x:4242] with HighID | Kad: ok
Total Download: 1.32 Tb, Upload: 3.16 Tb
Session Download: 860.17 Mb, Upload: 424.04 Mb
Download: 53.6 kB/s, Upload: 27.1 kB/s
Sharing: 652 file(s), Clients on queue: 1705
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xyz       7868  7.7  9.9 242352 103356 ?       RNl  Dec07  20:21 amule --even-if-lfroen-complains-this-will-stay

[...]

Fri Dec  8 00:50:05 CET 2006
aMule CVS Sun Dec  3 07:01:55 CET 2006 has been running for 4:22 h
xxxxxxx is connnnected to XXXXXXXXXXXXXX  [x.x.x.x:4242] with HighID | Kad: ok
Total Download: 1.32 Tb, Upload: 3.16 Tb
Session Download: 862.55 Mb, Upload: 425.29 Mb
Download: 58.3 kB/s, Upload: 31.7 kB/s
Sharing: 652 file(s), Clients on queue: 1701
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xyz       7868  9.3 66.4 1648336 686984 ?      DNl  Dec07  25:04 amule --even-if-lfroen-complains-this-will-stay
As I mentioned before in this thread, I first encountered this memory leak in January with v2.1.1. I really hope this gets fixed eventually.
Code: [Select]
$ rpm -qa | grep wx
wxGTK-gl-2.6.3-2.6.3.2.3.fc6
wxGTK-devel-2.6.3-2.6.3.2.3.fc6
wxGTK-2.6.3-2.6.3.2.3.fc6
Title: Re: memory usage
Post by: Ezeltje on December 09, 2006, 02:09:42 AM
...and again tonight: after an uptime of 1 hour, 43 minutes  X( X( X(

Code: [Select]
aMule CVS Sun Dec  3 07:01:55 CET 2006 has been running for 1:43 h
xxxxxxx is connnnected to XXXXXXXXXXXXXX  [x.x.x.x:4242] with HighID | Kad: ok
Total Download: 1.33 Tb, Upload: 3.16 Tb
Session Download: 326.13 Mb, Upload: 172.89 Mb
Download: 50.7 kB/s, Upload: 39.7 kB/s
Sharing: 657 file(s), Clients on queue: 2332
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xyz       3458 13.1 82.1 1713464 849312 ?      DNl  00:01  14:45 amule --even-if-lfroen-complains-this-will-stay
Title: Re: memory usage
Post by: phoenix on December 09, 2006, 04:24:39 AM
Ezeltje,

aMule runs in my computer for days without noticeable increase in memory usage, and believe me, I do stress aMule. I stress it to the point that I have reached a limit of open files in my system, when aMule starts to download like 800 files, it starts to fail. My next task will be to test a patch from a user that claims to only open the files when they are needed, thus increasing that limit a lot. My memory consumption is always around 10-13%. I have 512 mega of ram. I share 1580 files.
Code: [Select]
aMule CVS rev. 6988 has been running for 4:18 h
xxxxxxxxxx is connnnected to xxxxxxxxxxxxxxxx [xxx.xxx.xxx.xxx:xxxx] with HighID | Kad: ok
Total Download: 948.26 Gb, Upload: 345.63 Gb
Session Download: 491.68 Mb, Upload: 328.31 Mb
Download: 58.0 kB/s, Upload: 23.7 kB/s
Sharing: 1580 file(s), Clients on queue: 5000
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xxxxxx   31592 21.4 10.0 263472 103576 pts/3   Dl+  Dec08  55:30 /home/xxxxxx/amule --even-if-lfroen-complains-this-will-
Maybe your leak is somewhere else, maybe in wxGTK or gtk itself. I have heard that there could be a problem between two certain versions of wxGTK and gtk.
Title: Re: memory usage
Post by: Ezeltje on December 09, 2006, 03:14:19 PM
Quote
Originally posted by phoenix
aMule runs in my computer for days without noticeable increase in memory usage, and believe me, I do stress aMule. I stress it to the point that I have reached a limit of open files in my system, when aMule starts to download like 800 files, it starts to fail.
Wow, reminds me of DOS days (<1990). Remember the default FILES=20 in config.sys?  ;)

I had also thought I was stressing aMule too much, sharing 1600 files (~600Gb), so I experimented for a few days with just sharing my current downloads, but it didn't make much difference in stability.

Quote
Maybe your leak is somewhere else, maybe in wxGTK or gtk itself. I have heard that there could be a problem between two certain versions of wxGTK and gtk.
I am going to use amuled for the next week or so. If your hypothesis is correct, then I shouldn't see the leak. wx/gtk is only used for GUI stuff, right?

Later, I will also try running amule under Ubuntu to see if that makes any difference.

Thanks for the reply.
Title: Re: memory usage
Post by: phoenix on December 09, 2006, 08:44:48 PM
Quote
Originally posted by Ezeltje
I am going to use amuled for the next week or so. If your hypothesis is correct, then I shouldn't see the leak. wx/gtk is only used for GUI stuff, right?

Later, I will also try running amule under Ubuntu to see if that makes any difference.

Thanks for the reply.
Excelent idea! Please report your findings.
Title: update
Post by: Ezeltje on January 20, 2007, 04:53:19 PM
I now have an uptime with amuled of 21 days, so I think I can safely say the mem leak is not in the core:
Code: [Select]
$ cas
aMule CVS Sat Dec 16 07:01:50 CET 2006 has been running for 21 D 14 h
xxxxxxxxxx is connnnected to xxxxxxxxxxxxxxxx [xxx.xxx.xxx.xxx:xxxx] with HighID | Kad: off
Total Download: 1.40 Tb, Upload: 3.31 Tb
Session Download: 11.52 Gb, Upload: 71.57 Gb
Download: 2.8 kB/s, Upload: 45.0 kB/s
Sharing: 239 file(s), Clients on queue: 763
(BTW, I don't know why cas reports "Kad: off"; kad searches with amulecmd work fine.)

Virtual memory use has crept up to 637 MB, which seems like a lot:
Code: [Select]
$ ps u -C amuled
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xyz       3196  1.4  6.6 637488 68712 ?        Ssl   2006 465:38 amuled -f
but resident memory is only 68 MB and at least it hasn't gone haywire.

At this point, I am considering running aMule monolithic under Ubuntu for awhile. Rather than copy ~/.amule to my laptop (../incomplete = ~15 Gb) I am thinking of just mounting it as an NFS share. Is this a Bad Idea???

Another option might be to download and compile v2.8 of wxGTK on my FC6 box to see if it fixes the memleak under Fedora, but only if it won't trash vlc, my main media player. Thoughts anyone?
Title: Re: memory usage
Post by: niels on January 21, 2007, 04:42:32 AM
Hi phoenix,

Quote
Originally posted by phoenix
Ezeltje,

aMule runs in my computer for days without noticeable increase in memory usage, and believe me, I do stress aMule. I stress it to the point that I have reached a limit of open files in my system, when aMule starts to download like 800 files, it starts to fail. My next task will be to test a patch from a user that claims to only open the files when they are needed, thus increasing that limit a lot. My memory consumption is always around 10-13%. I have 512 mega of ram. I share 1580 files.
Code: [Select]
aMule CVS rev. 6988 has been running for 4:18 h
xxxxxxxxxx is connnnected to xxxxxxxxxxxxxxxx [xxx.xxx.xxx.xxx:xxxx] with HighID | Kad: ok
Total Download: 948.26 Gb, Upload: 345.63 Gb
Session Download: 491.68 Mb, Upload: 328.31 Mb
Download: 58.0 kB/s, Upload: 23.7 kB/s
Sharing: 1580 file(s), Clients on queue: 5000
$ ps u -C amule
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
xxxxxx   31592 21.4 10.0 263472 103576 pts/3   Dl+  Dec08  55:30 /home/xxxxxx/amule --even-if-lfroen-complains-this-will-
Maybe your leak is somewhere else, maybe in wxGTK or gtk itself. I have heard that there could be a problem between two certain versions of wxGTK and gtk.

Can you tell me which configure options did you use for wxGTK and aMule CVS? Have you compiled GTK too?

Thank you
Title: Re: memory usage
Post by: phoenix on January 22, 2007, 10:05:13 PM
Quote
Originally posted by niels
Hi phoenix,
Can you tell me which configure options did you use for wxGTK and aMule CVS? Have you compiled GTK too?

Thank you
Sure, but please notice that I am not the usual user. I always use debug flags, and I have more than one wxWidget version installed in my system. If you have any doubts, please ask.

I have not compiled gtk.

For wxGTK I do:

$ ./configure --enable-debug --disable-optimise --enable-debug_flag --enable-debug_info --enable-debug_gdb --with-opengl --enable-gtk2 --enable-unicode --enable-largefile --prefix=/home/myuser/usr/local/wxWidgets-2.8.0 && make && sudo make install

For aMule I will correspondingly do (notice the --prefix parameter above):

$ ./autogen.sh && ./configure --with-denoise-level=3 --enable-debug --disable-optimize --enable-verbose --enable-webserver --enable-webservergui --enable-amulecmd --enable-amulecmdgui --enable-ccache --enable-amule-daemon --with-wx-config=/home/myuser/usr/local/wxWidgets-2.8.0/bin/wx-config --enable-cas --enable-amule-gui && LD_LIBRARY_PATH=/home/myuser/usr/local/wxWidgets-2.8.0/lib/ make

If you want, you can add a --prefix to the amule compilation line too. Notice also that I do not mess with the system directories, I always install stuff in my own home directory, unless I use a system package like rpm or deb. I don't eve run make install on aMule, I run it from the command line in the directory it has been compiled like this (trunk, in this case):

$ LD_LIBRARY_PATH=/home/myuser/usr/local/wxWidgets-2.8.0/ LANG=en_US.UTF-8 trunk/src/amule --even-if-lfroen-complains-this-will-stay

As you can see, this can be simplified a lot. You probably do not need to build all the stuff like I do. Also, if you install wxGTK in a directory listed in ld.so.conf, you dont need the LD_LIBRARY_PATH stuff. Also, if your LANG is set, you dont need it too.

Good luck!
Title: Re: memory usage
Post by: niels on January 27, 2007, 11:52:31 PM
Thank you phoenix.

I'll test the aMule compiled with your instructions for a few days.
I have the same memory leak than Ezeltje, but i installed the aMule rpm for openSuse 10.2 from http://gw78.ja-nee.de/suse/10.2/

I don't know if the configure options will fix the problem.

I'll post the results.

Thanks again.
Title: Re: memory usage
Post by: Ezeltje on January 28, 2007, 12:04:27 AM
Niels,

I will be very interested in hearing about your experiences.

One thing: have you also compiled wxGTK? If so, can you run vlc to see whether it works under your configuration? It is the only other wx-based program I use, and it would be really inconvenient if a custom wx install nuked it.

TIA
Title: VLC and compiled wxGTK
Post by: niels on January 28, 2007, 01:12:34 PM
Hi Ezeltje,

      If you have problem with vlc and two versions of wxGTK, one installed in your home directory and another installed in the system directories, you can do one thing:

      Instead use the path of vlc (for example: /usr/bin/vlc) in aMule -> Preferences -> Directories -> Video Player, use the path to a script (for example: /home/myuser/bin/startvlc.sh) with this code:

Code: [Select]
#/bin/bash

declare +x LD_LIBRARY_PATH

/usr/bin/vlc "$1"

   Remember make it executable: chmod u+x /home/myuser/bin/startvlc.sh

   This script "delete" the LD_LIBRARY_PATH variable that was set in the command line to launch amule:  
LD_LIBRARY_PATH=/home/myuser/usr/local/lib/ LANG=en_US.UTF-8 ./amule --even-if-lfroen-complains-this-will-stay.

   VLC will find the libraries that are installed in the system and not in your home directory

   I hope this will be useful for you.
Title: Re: memory usage
Post by: Ezeltje on November 26, 2007, 09:54:03 PM
Hi all,

I was hoping this memleak bug was fixed in wxGTK v2.8 (if indeed it is there and not amule monolithic) but I just got it by it again after an uptime of 24 hours. Here is the top output I managed to capture before killing amule:

Code: [Select]
20:05:55 up 1 day, 27 min,  6 users,  load average: 22.20, 29.16, 32.42
Tasks: 209 total,  14 running, 195 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us, 99.1%sy,  0.0%ni,  0.0%id,  0.1%wa,  0.1%hi,  0.6%si,  0.0%st
Mem:   2074936k total,  2025640k used,    49296k free,      796k buffers
Swap:  1020116k total,  1020116k used,        0k free,     4948k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3743 xxxxx     20   0 2493m 1.8g  440 R   17 89.6 216:59.54 amule
 0164 xxxxx     20   0  200m 1080  444 S   10  0.1  63:20.15 audacious
  221 root      15  -5     0    0    0 D   12  0.0  10:06.68 kswapd0
 5317 xxxxx     20   0  110m 5676  996 D    7  0.3  40:17.46 k3b                                                                                       
 3291 root      20   0  110m  35m  232 R    6  1.7  73:50.54 X
10164 xxxxx     20   0  200m 1124  488 S   10  0.1  63:22.28 audacious
 3648 xxxxx     20   0 56948 1528  400 D    6  0.1   4:00.23 gnome-netstatus

Here, FWIW, is the cas output:

Code: [Select]
aMule CVS Fri Nov  9 07:01:54 CET 2007 has been running for 23:03 h
xxxxx is connected to ### xxxxxx ### [xxx.xxx.xxx.xxx] with HighID | Kad: ok
Total Download: 2.08 TB, Upload: 3.90 TB
Session Download: 1.99 GB, Upload: 1.10 GB
Download: 37.4 kB/s, Upload: 21.2 kB/s
Sharing: 853 file(s), Clients on queue: 925
Time: Nov 26 2007, 20:23

As I have indicated before, this bug does not occur with amuled.

Code: [Select]
$ rpm -qa | grep wx
wxGTK-2.8.4-6.fc8
wxGTK-devel-2.8.4-6.fc8
wxGTK-gl-2.8.4-6.fc8
compat-wxGTK26-2.6.3-8

$ uname -r
2.6.23.1-49.fc8[code]
[/code]
Title: Re: memory usage
Post by: Ezeltje on March 27, 2010, 09:40:27 PM
Wow, this mem leak is still in the code; it bit me in the ass again this evening:

Code: [Select]
top - 21:27:23 up 16 days,  8:05, 11 users,  load average: 31.47, 33.96, 37.49
Tasks: 341 total,   2 running, 338 sleeping,   0 stopped,   1 zombie
Cpu(s):  0.2%us,  0.9%sy,  0.0%ni, 19.8%id, 79.0%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   3355684k total,  3265356k used,    90328k free,     1856k buffers
Swap:  2048248k total,  2048248k used,        0k free,    13428k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
 5621 xxxx     20   0 2728m 2.2g  552 D  0.0 67.6   1675:46 amule             
 5459 xxxx     20   0  678m 129m  144 S  0.0  3.9 433:35.64 java               
18557 xxxx     20   0  713m  65m  412 S  0.0  2.0  47:15.33 thunderbird-bin   
20162 xxxx     20   0  624m  56m 1204 D  0.6  1.7  32:25.90 chrome             
28988 xxxx     20   0  524m  43m  260 S  0.0  1.3  46:33.79 acroread           
 2291 root     20   0  241m  37m  632 D  0.0  1.1 528:52.23 Xorg               
15502 xxxx     20   0  146m  33m  264 S  0.0  1.0   0:12.53 chrome 
...
As you can see, when I finally killed it, amule was using 67% of the 4G RAM.

Code: [Select]
$ rpm -qa | egrep "(amule|wx)" | sort
amule-2.2.6-1.fc12.i686
amule-nogui-2.2.6-1.fc12.i686
wxBase-2.8.10-7.fc12.i686
wxGTK-2.8.10-7.fc12.i686
wxGTK-devel-2.8.10-7.fc12.i686
wxGTK-gl-2.8.10-7.fc12.i686
wxGTK-media-2.8.10-7.fc12.i686
Title: Re: memory usage
Post by: Stu Redman on March 27, 2010, 10:05:24 PM
How fast is your upload speed?
If it's very fast (LAN speed) try the SVN version. There is a fix for such a memleak problem in it.