2

Is there any magic command to track down which process is starting this perl task that is eating 100% of CPU time? I have this problem on several machines where JBoss AS is installed.

enter image description here

  • Does freebsd know the renice command? You could at least make it run a bit slower. – ott-- Jul 19 '13 at 9:41
  • With what uid is that process running? The same as apache? – ott-- Jul 20 '13 at 18:01
1

You can use procstat on FreeBSD.

procstat $PID

gives you the an overview of the process for example

 PID  PPID  PGID   SID  TSID THR LOGIN    WCHAN     EMUL          COMM        
8898  8894  1977  1977     0   6 tant     usem      FreeBSD ELF64 chrome

The PPID is the ID of the parrent process which might have started the process.

With

procstat -f $PID

you get the files opened by the $PID

procstat -c $PID

gives the arguments of that process.

The process looks suspicious. There is no /usr/bin/javad you should check if this process really opens this file or if the program has overwritten the first argument.

  • procstat says that this perl process (PID 38181 in this example) PPID is 1 which is /sbin/init. procstat -f shows that none file is open by this process. procstat -c shows this argument: /usr/bin/javad. – Mark Zakred Jul 19 '13 at 11:37
  • @MarkZakred OK ether the program was started with as a background process or the starting process has finished. Could you give the whole out put of procstat -c? – Raphael Ahrens Jul 19 '13 at 11:39
  • @MarkZakred Also add the output of procstat -f. – Raphael Ahrens Jul 19 '13 at 11:52
  • Here you go: ideone.com/lq3EPw – Mark Zakred Jul 19 '13 at 12:29
  • Mhh this looks really fishy! – Raphael Ahrens Jul 19 '13 at 12:31
0

You can see more information about the command by running

ps l 39181

This will show the command's arguments, which will usually include the name of the script that is being run.

If you wish to stay in top, you can press f and select the information fields that you would like to see. Look for the PPID. This is the ID of the process that spawned the perl process.

  • ps l 39181 gives me /usr/bin/javad (perl5.16.2) and ls -la /usr/bin/javad says that ls: /usr/bin/javad: No such file or directory. – Mark Zakred Jul 19 '13 at 6:23
  • also, freebsd's top doesn't have f switch: freebsd.org/cgi/man.cgi?query=top&sektion=1 I'd appreciate if you could point me to which one is equivalent to GNU's f in top. Thanks. – Mark Zakred Jul 19 '13 at 6:29
  • @MarkZakred mhhh there shoukld not be a javad in /usr/bin/. – Raphael Ahrens Jul 19 '13 at 10:34
0

You can do a ps -fp processid to see the parent process. Use ps -fjp pid to see the progress group id and the group id will give you the hierarchy of processes.

Edit: As noted by comments below (and I don't have comment privileges yet), this only works in Linux.

  • The FreeBSD version of ps has a different interpretation of -f here the man page entry: "Show commandline and environment information about swapped out processes. This option is honored only if the UID of the user is 0." – Raphael Ahrens Jul 19 '13 at 12:29
  • ps -jp: ideone.com/MpyIid – Mark Zakred Jul 19 '13 at 12:35
0

top is the beautiful command which will list all the processes running, % of CPU utilization, % of memory utilization along with all other important information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.