Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

Running PRO-IV as a UNIX ksh


4 replies to this topic

#1 Jeff Hon

Jeff Hon

    Member

  • Members
  • PipPip
  • 29 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 25 April 2003 - 03:14 AM

Hi all,

We have a customer site that has implemented a UNIX menu script to start their PRO-IV sessions as ksh processes. This method of starting PRO-IV seems to be fine except when the PRO-IV client's disconnects from the server abnormally, ie. due to PC reboot or network disruption. What happens then, is the ksh process starts spinning and starts using up a high amount of CPU resources. The PRO-IV timeout settings we implemented does not kick in here as the process is not idle as such as it is using up CPU.

Basically, the script goes:

echo "   1. Start Application"
read -r Ans
case $Ans in
1)  $DIR/start_proiv_apps_script
     ;;
esac
done
exit

The are running on an RS6000/AIX 4.3.

Has anyone had any experience with similar problems running PRO-IV as a ksh? Any suggestions would be greatly appreciated.

Kind Regards,
Jeff.

#2 Mike Schoen

Mike Schoen

    Expert

  • Members
  • PipPipPipPip
  • 198 posts
  • Gender:Male
  • Location:Guelph, Canada

Posted 25 April 2003 - 01:14 PM

We use ksh as the default shell, and also find this happening the odd time.
I dont think our one AIX customer has this problem, but I have seen it on
hpux 10 when a user just turns their terminal off.

On redhat , and hpux11 (I think) I have tested dopping a gui client to see what the OS does,
and it drops the session after about 3 minutes (when using oracle database though)


You might want to try to exec the script, to see if that makes a difference

#3 Tony Waszkiewicz

Tony Waszkiewicz

    Expert

  • Members
  • PipPipPipPip
  • 174 posts
  • Gender:Male
  • Location:London, United Kingdom

Posted 25 April 2003 - 03:29 PM

Hi,

We have seen this happen with version 4.n running on Solaris with the bourne shell and also the ALPHA VMS which of course runs neither shell. If you have some Unix expertise I think it should be possible (through Unix of course) to determine the time since a user last did any action and therefore kill the process if its over some arbitrary time. With a bit more effort you could probably also know the amount of cpu that was being used. HTH

#4 wicoulte

wicoulte

    Member

  • Members
  • PipPip
  • 18 posts
  • Gender:Male
  • Location:Otis Elevator
  • Interests:Primarily interested in Pro-IV administration.

Posted 07 May 2003 - 10:00 PM

We may have a similar problem. We're running a 4.0 kernel on Digital Unix 4.0 with Oracle. The script that is executed at logon to start the 'pro' executable is a Korn script, although the users default shell is the Bourne shell. What I see happen is the sh process that starts the Korn shell issues 'clear' commands at an amazing rate after the user abnormally terminates. I run the following code in a Korn script periodically via crontab (as 'root') to recogize when this happening and kill the offending process:

# This looks for any high CPU process that is running the bourne
# shell ('-sh'), whose parent is 'telnetd', and is spawning children that are
# running 'clear'

typeset EMAIL_LIST="CHESSAlert@otis.com"
ps -a -o pid=1 -o pcpu=2 -o user=3 -o ppid=4 -o command=5 | egrep -v QUE | egrep -v grep | egrep -v pro4bin/pro | while read LINE
do
PCT_CPU=`echo $LINE | awk '{print $2 }'`
if [ $PCT_CPU -gt 15 ]; then
        OSUSER=`echo $LINE | awk '{print $3 }'`
        PPID=`echo $LINE | awk '{print $4 }'`
        PRGRM=`echo $LINE | awk '{print $5,$6 }'`
        PID=`echo $LINE | awk '{print $1 }'`

#find the parent process id for the high usage process if it is a shell process

        if [[ $PRGRM = '-sh (sh)' ]]; then
                ps -ea -o pid=1 -o user=2 -o command=3 | grep $PPID | egrep -v grep | while read LINE2
                do
                PARENT_USER=`echo $LINE2 | awk '{print $2 }'`
                COMMAND=`echo $LINE2 | awk '{print $3}'`

                if [[ $COMMAND = 'telnetd' && $PARENT_USER = 'root' ]]; then
                        COUNT=0
                        CLEAR='N'
                        while [[ $COUNT -lt 5 ]]
                        do
                                ps -ea -o ppid=1 -o command=2 | grep $PID | egrep -v grep | while read LINE3
                                do
                                CMMND=`echo $LINE3 | awk '{print $2 }'`
                                if [[ $CMMND = 'clear' ]]; then
                                        CLEAR='Y'
                                fi
                                COUNT=`expr $COUNT + 1`
                                done
                        done
                        if [[ $CLEAR = 'Y' ]]; then
                                do_command "kill -9 $PID"
                                typeset MESG="Process $PID, user $OSUSER was a runaway process.  The process was running '${PRGRM}'
and consuming ${PCT_CPU}% of the CPU. It was spawning 'clear' commands and the parent process was ${COMMAND}. $PID has been killed."
                                typeset SUBJECT="Runaway process detected"
                                mail_someone "$EMAIL_LIST" "$MESG" "$SUBJECT"
                        fi
                fi

                done
        fi
fi

done

It took quite a bit of futzing to get to the point where I felt safe putting in the 'kill' statement, but it has never killed anything inappropriately and we've not had troubles with slow downs due to high CPU processes since we implemented it.

It will probably take some futzing on your part, too.

When I pasted the code excerpt in it was indented for readability, but looking at the preview I see it's not going to appear that way in the post. Sorry...

Bill Coulter

#5 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,652 posts
  • Gender:Male
  • Location:Spain

Posted 07 May 2003 - 11:37 PM

Bill,

If you want to post code and indent it, then you have to use the CODE button. When you enter the post there is a group of buttons above the post box. Press the 'CODE' button, then enter your code and then press 'CODE' button again.

I have editted your post to include these.

Rob D.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Click the link below to see the new game I'm developing!