opsengine / cpulimit

CPU usage limiter for Linux
Other
1.7k stars 270 forks source link

Assertion tmp process failed #27

Open emmanuelgeoffray opened 10 years ago

emmanuelgeoffray commented 10 years ago

Good morning!

Running $ cpulimit -l 240 python myscript.py on a quad-core debian with the master branch at this date After 20 minutes, I get:

cpulimit: process_group.c:203: update_process_group: Assertion `tmp_process.ppid == p->ppid' failed. 

myscript.py runs 60 to 120 child process.

Any clue how to fix that?

Thank you, Emmanuel

opsengine commented 10 years ago

Hi,

Can you send a minimal version of your python script so I can reproduce?

Thanks Angelo

2014/1/9 Emmanuel Geoffray notifications@github.com

Good morning!

Running $ cpulimit -l 240 python myscript.py on a quad-core debian with the master branch at this date After 20 minutes, I get:

cpulimit: process_group.c:203: update_process_group: Assertion `tmp_process.ppid == p->ppid' failed.

myscript.py runs 60 to 120 child process.

Any clue how to fix that?

Thank you, Emmanuel

— Reply to this email directly or view it on GitHubhttps://github.com/opsengine/cpulimit/issues/27 .

Angelo Marletta

emmanuelgeoffray commented 10 years ago

Hey, Thanks for replying so quickly. The script is on this repo

There's a install_dependencies.sh script, mostly to download/install python libs. After that, you can run the script with cpu-limit:

$ cpulimit -l 240 python run_webcams.py

Thanks! Emmanuel

emmanuelgeoffray commented 10 years ago

I changed some things in my script to get it running for now, without cpulimit. So if you test the script, make sure you use the commit mentioned in the link above. Thanks! Emmanuel

zarere commented 9 years ago

Hi Angelo,

Is there a fix for the bug mentioned here?

opsengine commented 9 years ago

The issue should be solved. Please confirm.

zarere commented 9 years ago

Hi Angelo,

Sorry for the late reply.Now I get the following error:

cpulimit: process_group.c:175: update_process_group: Assertion `tmp_process.starttime == p->starttime' failed

zarere commented 9 years ago

Hi Angelo,

Here is some more information which program I'm using.I'm using it that way:

martin@maleksov ~ $ sudo cpulimit -l 200 -i -p 5248 Process 5248 found cpulimit: process_group.c:175: update_process_group: Assertion `tmp_process.starttime == p->starttime' failed

http://dox.bg/files/dw?a=7cc855d269

zarere commented 9 years ago

Hi Angelo,

Any idea when the issue with the cpulimit: process_group.c:175: update_process_group: Assertion `tmp_process.starttime == p->starttime' failed is going to be fixed.

Thanks in advance.

zarere commented 9 years ago

Hi Angelo,

Any updates?

BR Martin

Berbe commented 9 years ago

Hello, Are there any news on this bug? I am experiencing very frequently the exact error message @zarere just told about: cpulimit: process_group.c:175: update_process_group: Assertiontmp_process.starttime == p->starttime' failed` The consequence is the process being run crashes in a dirty manner...

I am really considering giving cpulimit up and use the nice command along with some regular checks using the renice one. Any news on the matter?

arstercz commented 4 years ago

I have the same error when use mongodump, but it's ok when backup without -i option:

$ cpulimit -l 80 -i mongodump  --host=localhost --db=sbtest1 --numParallelCollections=4 --out=/data/backup
T=1591260162.399432 PID=12771 PPID=12770 START=15192000 CPUTIME=10
2020-06-04T16:42:42.400+0800    writing sbtest1.sbtest1 to 
2020-06-04T16:42:42.410+0800    done dumping sbtest1.sbtest1 (1013 documents)
T=1591260162.417804 PID=12771 PPID=1852402733 START=2016245877 CPUTIME=912209464
cpulimit: process_group.c:175: update_process_group: Assertion `tmp_process.starttime == p->starttime' failed.

$ cpulimit -l 80  mongodump  --host=localhost --db=sbtest1 --numParallelCollections=4 --out=/data/backup
T=1591262671.908695 PID=43043 PPID=43042 START=15194510 CPUTIME=0
T=1591262671.909086 PID=43043 PPID=43042 START=15194510 CPUTIME=0
2020-06-04T17:24:31.924+0800    writing sbtest1.sbtest1 to 
2020-06-04T17:24:31.934+0800    done dumping sbtest1.sbtest1 (1013 documents)

it seems something was wrong in get_next_process so that tmp_process get wrong starttime or cputime:

diff --git a/src/process_group.c b/src/process_group.c
index 06d73a6..5285922 100644
--- a/src/process_group.c
+++ b/src/process_group.c
@@ -141,9 +141,9 @@ void update_process_group(struct process_group *pgroup)

        while (get_next_process(&it, &tmp_process) != -1)
        {
-//             struct timeval t;
-//             gettimeofday(&t, NULL);
-//             printf("T=%ld.%ld PID=%d PPID=%d START=%d CPUTIME=%d\n", t.tv_sec, t.tv_usec, tmp_process.pid, tmp_process.ppid, tmp_process.starttime, tmp_process.cputime);
+               struct timeval t;
+               gettimeofday(&t, NULL);
+               printf("T=%ld.%ld PID=%d PPID=%d START=%d CPUTIME=%d\n", t.tv_sec, t.tv_usec, tmp_process.pid, tmp_process.ppid, tmp_process.starttime, tmp_process.cputime);
                int hashkey = pid_hashfn(tmp_process.pid);
                if (pgroup->proctable[hashkey] == NULL)