PROBLEM:	(HPAQ40CCC)	(Patch ID: OSF350-233)
********
This patch fixes a problem in which cron jobs will not run if there is an 
unfinished job in another queue. This problem occurs even if the queue for 
the job is empty.

Typically, a long job is the only job scheduled from cron.  After that job 
terminates, another cron job starts executing.  This results in several 
"MAXRUN procs reached" messages getting displayed to the error
log. The /var/adm/cron/FIFO file, which should only exist while jobs remain
queued, remains around much longer than expected.

This problem can be reproduced by running the following test.  To do this, 
you need three windows running the following commands:
 truss -p <CRON PID>    You might want to script
 tail -f /var/cron/log    the truss and batch_two.ksh
 batch_two.ksh     processes.

The batch_two.ksh file is:
#!/bin/ksh
 echo "sleep 9999" | batch
 integer COUNT=1
 while [ COUNT -lt 60 ] ; do
  echo "sleep 15" | batch
  (( COUNT = COUNT + 1 ))
 done

 (
 sleep 222
 echo "sleep 700" | at -qr now +1 minute
 echo "sleep 750" | at -qr now +1 minute
 echo "sleep 800" | at -qs now +1 minute
 echo "sleep 14" | batch
 ) &

 integer STOP=0 PS
 while [ $STOP -eq 0 ] ; do
  atq | tee /tmp/atq.out
  ps -ef|grep sleep | tee /tmp/ps.out
  ls -l /etc/cron.d/FIFO
  date
  PS=`cat /tmp/ps.out | wc -l`
  AT=`cat /tmp/atq.out`
  [ $PS -le 1 -a "$AT" = "no files in queue." ] && STOP=1 || sleep 10
 done
 echo "$0 finished."
 rm -f /tmp/atq.out /tmp/ps.out


        integer STOP=0 PS
 while [ $STOP -eq 0 ] ; do
  atq | tee /tmp/atq.out
  ps -ef|grep sleep | tee /tmp/ps.out
  ls -l /etc/cron.d/FIFO
  date
  PS=`cat /tmp/ps.out | wc -l`
  AT=`cat /tmp/atq.out`
  [ $PS -le 1 -a "$AT" = "no files in queue." ] && STOP=1 || sleep 10
 done
 echo "$0 finished."
 rm -f /tmp/atq.out /tmp/ps.out

<end of ksh script>
       
The previous test shows that a long running job will prevent cron from
scheduling jobs from any queue until one of the following events occur:

 1) The long running job exits, or
 2) Cron exhausts the FIFO list of already completed jobs
    (one minute per job)

Either of these conditions may take a very long time.  For a long running job, 
such as a part14 report, it may be hours.  It could take cron a very long time 
to exhaust the FIFO list at one minute per job (200 completed jobs = 3.3 hours).

The intertesting part of the test occurs when the background sleep 222
completes and places the four new jobs in queues r, s, and b. These jobs will 
wait for a long time when they do not need to wait at all.


PROBLEM:        (QAR 47149, UVO104578CBR)       (Patch ID: OSF350-291)
********
This patch fixes a problem that occurs on multi-processor machines in which the
at command causes extra batch jobs to be executed.

Sometimes temporary files are created and not removed, causing the queue limit
to be exceeded.


FILE(s):

/usr/sbin/cron			subset OSFBASE350
CHECKSUM: 61915     48	RCSfile: cron.c   RCS: 4.2.34.3
