Forum archive 2000-2006

Alberto Candel - lingering perl procesess

Alberto Candel - lingering perl procesess

by Arnold Pizer -
Number of replies: 0
inactiveTopiclingering perl procesess topic started 9/22/2004; 10:56:59 PM
last post 9/24/2004; 5:10:47 PM
userAlberto Candel - lingering perl procesess  blueArrow
9/22/2004; 10:56:59 PM (reads: 1651, responses: 9)
Hello, We are running WW 1.9. Everything is fine but in the past days the server has slowed down considerably, to the point that we often get "Pink pages" timeouts.

There appears to be quite some number of perl processes runnning, some of them for quite some time. The system on which WW is running is a 1.33GHz PowerPC G4 with 1GB RAM. We are not short on RAM, but we are reaching the CPU limits.

Any suggestions at what may be causing this slowdown? I can send some stats if you think they may help (but I guess I cannot copy them here in this box?)

Thanks a lot.

Alberto

<| Post or View Comments |>


userJohn Jones - Re: lingering perl procesess  blueArrow
9/23/2004; 2:48:59 PM (reads: 1876, responses: 1)
It sounds like you may have a problem with an infinite loop in it. We saw this kind of behavior with webwork 1. Looking at the code, it looked like it was supposed to time itself out, but under slackware linux, it didn't. Kill the long running perl processes.

If this is the problem, then it can be hard to pinpoint. The offending problem is probably fine for most seeds, so it is only when a particular individual hits the problem that it starts looping forever. Keep your ears open for complaints about an individual who can't see a particular problem or cannot get hardcopy of some set.

John

<| Post or View Comments |>


userAlberto Candel - Re: lingering perl procesess  blueArrow
9/23/2004; 3:25:40 PM (reads: 2102, responses: 0)
Thank you John. I killed those processes and server speed has improved.

Before that, I looked at some outpus (top & ps) and saw that the offending script seems to be welcomeAction.pl

Is this the one that you say may have an infinite loop in it?

Thanks again,

Alberto

<| Post or View Comments |>


userArnold K. Pizer - Re: lingering perl procesess  blueArrow
9/23/2004; 6:07:01 PM (reads: 1850, responses: 0)
Hi Alberto,

John was suggesting that some pg problem (not a WeBWorK script) may have an infinite loop in it for a certain seed. E.g maybe a problem has the code while

($a = 0) {do something to $a} 
but under certain circumtances (for some seed) $a is always 0. This is pretty rare but has happened on occasion --- usually with very comlicated problems. This is more likely to happen with locally written problems since most (but not all) problems in the distributed library have been used by a lot of students. Since you saw that the offending script was welcomeAction.pl, most likely WeBWork was reading a problem when trying to create a hardcopy of some set.

Arnie

<| Post or View Comments |>


userJohn Jones - Re: lingering perl procesess  blueArrow
9/23/2004; 6:09:16 PM (reads: 1859, responses: 1)
WelcomeAction is called when someone wants hardcopy. So, there is still likely that at least one problem with some seed value produces an infinite loop. When the right version of that hard copy is requested, you get the infinite loop.

Unfortunately, the bug is still in some problem file. If you have a small operation, you could fish around requesting hard copies for lots of students of sets where were open when those processes started. That might help you find the buggy problem.

John

<| Post or View Comments |>


userAlberto Candel - Re: lingering perl procesess  blueArrow
9/23/2004; 10:55:16 PM (reads: 2115, responses: 0)
Following your suggestions and after some digging I came to the conclusion that the offending problem is at

 

setAlgebra13Inequalities/p19.pg

with

seed=4047
(From the UR problem database).

This problem produces a "Pink Page". I observed the server from the moment that one requests the problem to the pink page and there is a perl process using lots of CPU. But it dies after that (at least in the couple of tests that I did).

Thank you,

Alberto

<| Post or View Comments |>


userArnold K. Pizer - Re: lingering perl procesess  blueArrow
9/24/2004; 7:35:09 AM (reads: 1845, responses: 1)
Thanks Alberto,

This bug isn't even tricky but it's a good clear example of what not to do when writing problems. The main thing is to be aware that such things can easily happen. The offending code is:

$a = random(1,8,1);
$c=random(2,8);
do {$b = random(1,$c-1,1);} until ($b !=$a);

Now if $a = 1 and $c = 2 it will loop forever. Changing $c to

$c=random(3,8);

will fix this. I actually do not remember how the time out for hardcopy works. For html pages I think it is set to 30 seconds which is why you saw the process stop.

I'll fix this problem in the CVS library right now. Thanks.

Arnie

<| Post or View Comments |>


userAlberto Candel - Re: lingering perl procesess  blueArrow
9/24/2004; 1:08:58 PM (reads: 2116, responses: 0)
Thank you, I'll take note of this example. I found some typos in some other problems from setAlgebra, but I'll post them in a new topic for ease of reference.

Alberto

PS. This may have been answered elsewhere, but ... if I were to edit the problem file p19.pg as you suggest, would that make changes to the versions of this problem that the students already have from when I built the set? I would like to avoid new loops.

<| Post or View Comments |>


userJohn Jones - Re: lingering perl procesess  blueArrow
9/24/2004; 3:22:59 PM (reads: 1870, responses: 1)
If your courses have links to a single directory which contains this problem under it (which is now the typical way of setting things up), then changing the one file changes the problem for all students in all courses which have it.

When changing "live" problems, I try to change them so that the random values won't change for people who have a good version - only for those who need new values. For you this may not be important (e.g., if there is just one class and you can make an announcement).

It is sometimes more difficult to do that, but usually not too bad. In this problem, it can be accomplished with

$a = random(1,8,1);
do{ $c=random(2,8); } until ($a != 1 or $c != 2);
do {$b = random(1,$c-1,1);} until ($b !=$a);

John

<| Post or View Comments |>


userAlberto Candel - Re: lingering perl procesess  blueArrow
9/24/2004; 5:10:47 PM (reads: 2114, responses: 0)
Thanks for the fix. I am afraid this discussion is leading to a different topic, but ...

I am running several instances of the same course, and each has its own set of templates. Originally I thought to do as you say say, having a single directory with all the problems, but decided against it because of several things: I would have to modify too many set.def files (originally I was using those from Bill Ziemer), I didn't want that some other instructor would accidentally edit some .pg file, and I was not sure about the answer to the following:

What would be the ideal (relative) position for that directory?

What are the corrrect permissions for it?

And for the .pg files?

Thank you,

Alberto

<| Post or View Comments |>