LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   CentOS -- Perl Using 95% Of Both My CPUs (https://www.linuxquestions.org/questions/linux-general-1/centos-perl-using-95-of-both-my-cpus-591105/)

JustinK101 10-11-2007 12:07 PM

CentOS -- Perl Using 95% Of Both My CPUs
 
Hello, just recently PERL has been eating all my cpu power. I am running a dual xeon server, and the perl process is going crazy. I tried restarting no luck, still eating cpu. Here is what top is displaying:

Cpu0 : 92.0% us, 8.0% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si
Cpu1 : 92.0% us, 8.0% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7266 root 25 0 7172 4212 2744 R 95 0.2 475:51.23 perl
7220 root 25 0 7160 4212 2744 R 51 0.2 487:20.17 perl
7168 root 25 0 7228 4212 2744 R 50 0.2 492:44.44 perl


Any ideas what is going on? Can I see which process is using the perl process? Thanks for the help.

Tischbein 10-11-2007 08:43 PM

Code:

pstree | less
shows all your processes as a tree. You might have to install pstree. There are also gui versions but if you're aready tight on CPU you won't enjoy agonisingly slow render times.

matthewg42 10-11-2007 09:06 PM

They are probably something broken, but in case you suspect they are maliciouos, you might want to snoop them a little:
You can find out what files they have open like this (example for one of the process IDs):
Code:

lsof -p 7266
You can also connect to them with strace to see what system calls they are making, e.g.:
Code:

strace -p 7266
If you want to grep the output of strace, you need to re-direct stderr to stdout first, e.g.
Code:

strace -p 7266 2>&1 |grep ^open
You might also want to see if these processes are connected to any remote hosts:
Code:

netstat -p |grep perl
You can also get a load of information out of the /proc/7266 area. Looking in the environ can be interesting. cmdline might tell you what the script's file is, but it also might not, depending on how the script was invoked.

trickykid 10-14-2007 07:43 AM

Find out what perl script or program is running and take it from there? Perl is usually invoked and doesn't run as a service. Seems to be it might be a cron job or some type kicking off and hanging, then the ones behind it are doing the same thing. I've seen perl scripts used to backup databases that go horribly wrong or cause high cpu usage, memory usage, etc.

JustinK101 10-24-2007 11:59 AM

Ok, seems to be a perl script which updates my dynamic ip address with dtdns.org. It seems to be hanging and then others just stack right on top of it. It is wierd though because the script works, but just after a while of running cron tasks every 5 minutes they seem to start failing.

Can I limit the amount of time a cron script runs for? For example, is the process runs for more then 15 minutes then kill the PID?

Thanks for the help.


All times are GMT -5. The time now is 08:23 AM.