Operating System - HP-UX
1834862 Members
2101 Online
110070 Solutions
New Discussion

Re: Handling Application Process 100% CPU

 
ben_43
Frequent Advisor

Handling Application Process 100% CPU

Hello Team:

I wanted to have some advice on how to handle an Xapplication process which occupies 100% CPU after user exits. I know that finally the application has to do some thing about the codes, but i need to know if someone in the forum has faced similar issues and i would like to know how they have handled that. we use an xemulator to launch the app from PC.Please Help.

Thanks
Ben.
4 REPLIES 4
Bill Hassell
Honored Contributor

Re: Handling Application Process 100% CPU

The user is not exiting the application correctly or the application is poorly written. Since the Xprogram is running on another machine, it knows very little about whether the display is local or remote and if a PC user crashes (somewhat common) or simply stops the Xemulator without stopping the program, there is no place for the Xprogram to display and it will likely go into a loop.

This is quite common unsophisticated users so your only choices are:

- rewrite the application(s) to check the status of the display server (the PC emulator) if you have the tools to do so.

- educate the users about proper shutdown of the application

- don't export the VUE or CDE desktop to the remote users, just telnet to the server and start the application. VUE/CDE is an enormous load on the network and way more complicated than a single application.

- if education doesn't work, then social engineering is needed (ie, write a script to cleanup the mess).

For a runaway program cleaner, you'll first have to inventory the Xprograms that are causing the problem. Then, in the cron script, check if one of those processes is consuming 100% CPU, but don't kill it yet. You have to write the PID to a temp file, ie, the penalty box.

You have to determine how long the process should stay at 100% which means looking again after a minute or two to see if the accumulated CPU time matches the time you waited, in other words, the process continues to accumulate CPU time at the maximum rate. You don't want to kill a process just because it was using 100% CPU during a single measurement period since this may normal for a short time.


Bill Hassell, sysadmin
ben_43
Frequent Advisor

Re: Handling Application Process 100% CPU

Hi:


Thanks. But in my case there is no doubt about the process consuming CPU because sometimes the user has already logged out(don't see him in who). I see the parent process of the runaway also present at the time of runaway, Can some one help here?

Thanks
Ben.
Tom Maloy
Respected Contributor

Re: Handling Application Process 100% CPU

Ben,

I've had this same problem, and it was entirely user error (as Bill suggested). The user was not exiting the application, just closing the window. The application did not notice that the window was gone, and kept trying to run, using 100% of the CPU.

Since it was always the same application, a script was written that would look for the script running with a PPID of 1 - runaway process. If found, it would be killed.

Since this runaway also dragged the system to its knees, I was able to get the user to change the way he left the application. (Turns out that he did not even realize that it made a difference which way he exited the program.) It took a few conversations, but it did work.

More social engineering...

Tom
Carpe diem!
Martin Johnson
Honored Contributor

Re: Handling Application Process 100% CPU

I have a similar problem. I check CPU utilization and the parent PID. If CPU is high and the PPID is 1, I kill the process. So far, talking to the users has had no apparent effect on their behavior.


HTH
Marty