[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

473.0. "RMS not flushing on process delete" by NWD002::MURRAY_RU () Tue Apr 15 1997 03:12

    Hi,
    
    I currently have an application that uses shared RMS indexed files.  I
    have found that if I abort a process that has updated a file that all
    the changes are not flushed to the disk.  Thus records that were
    deleted reappear in the file.  Occasionally, indexes are dropped to
    specific records.  
    I have also found that if I type the file before I abort the process
    the buffers get flushed and things are kosher.  Also none shared files
    seem to flush just fine.  
    
    In old times on RSX I could establish an ast to be executed if the
    proces were aborted.  This allowed me to close all the files
    appropriately.  I have not yet been able to find a way to trap the
    delete AST that VMS uses.  If this is the preferred way to get
    information flushed to the disk on process abort could someone please
    give me a pointer to how this is done.
    
    I am curently running vms 6.1 and the application is in fortran.  I
    don't do any special user opens or anything.  
    
    Thanks for any help or pointers.
    
    Russell Murray
      
T.RTitleUserPersonal
Name
DateLines
473.1$DCLEXH?GIDDAY::GILLINGSa crucible of informative mistakesTue Apr 15 1997 03:5613
  Russell,

    You can use SYS$DCLEXH to declare an exit handler, however the exact
  behaviour depends on what you mean by "abort a process". If you mean
  $DELPRC (or STOP/ID) then all bets are off. The process is summarily
  deleted and user mode exit handlers are not run. If you use a softer
  mechanism like SYS$EXIT (from within the process) or SYS$FORCEX (from
  outside), your exit handler will run (but it probably won't need to since
  the user mode FORTRAN and RMS handlers will clean up properly). If you
  want to flush the buffers "manually" you can use SYS$FLUSH. Use FOR$RAB to
  find the RAB address from FORTRAN unit number.

						John Gillings, Sydney CSC
473.2$delprc isn't an $exit, it's a delete...XDELTA::HOFFMANSteve, OpenVMS EngineeringTue Apr 15 1997 12:0517
   With STOP/ID ($DELPRC), what you are seeing is expected behaviour.
   $DELPRC is a "big hammer", and is designed and intended to stop the
   process *immediately*.  This is deliberate, and means that $DELPRC
   cannot be (easily) ignored, and cannot (typically) fail...

   One can use an executive or kernel-mode rundown via UWSS (see the
   user-written system service), but I do not recommend this approach.

   Rather, I'd recommend using $FORCEX, or an application-specific
   "exit request" mechanism.  In either case, exit handler(s) can call
   for a flush, and can close all open files.

   Alternatively, recode the application to issue a flush at the
   appropriate synchronization points, or recode the application
   to use RMS journaling, or both.

473.32�EVMS::MORONEYHit <CTRL><ALT><DEL> to continue ->Tue Apr 15 1997 14:593
With 20-20 hindsight, STOP/ID should have been coded to invoke $FORCEX, with
an additional $ STOP/ID/I_REALLY_REALLY_MEAN_IT to invoke $DELPRC for the
times it's needed.
473.4STOP/EXIT=PID would call $forcexXDELTA::HOFFMANSteve, OpenVMS EngineeringTue Apr 15 1997 15:076
:With 20-20 hindsight, STOP/ID should have been coded to invoke $FORCEX, with
:an additional $ STOP/ID/I_REALLY_REALLY_MEAN_IT to invoke $DELPRC for the
:times it's needed.

    I've always thought that STOP/EXIT=PID would be a nice addition to DCL.
473.5EPS::VANDENHEUVELHeinTue Apr 15 1997 16:2125
>    I currently have an application that uses shared RMS indexed files.  I
>    have found that if I abort a process that has updated a file that all
>    the changes are not flushed to the disk. 
    
    RMS out-of-the-box will NOT exhibit this behaviour.
    RMS in a shared environment _will_ flush through changes.
    RMS does have an option called DEFERRED WRITE which, you guessed
    it, will defer writes and make application prones to errors.
    
    Now FORTRAN on the other hand, may well default to set this
    option it being a technical (=performance focus) language
    and not a commercial (=security focus) language.
    To switch this 'feature' off, you'll need a USEROPEN.
    You may also want to consider a (timer-based) algoritme
    to call SYS$FLUSH periodically, or investigate RMS RU-
    Journalling for true transactional integrety.
    
    Oh, and if you do decide to switch off deferred write, please
    consider the potential performance ramifications before hand!
    
    hth,
    	Hein.
    
    
    
473.6AUSS::GARSONDECcharity Program OfficeTue Apr 15 1997 22:1911
    re .3
    
    What you really want is something that terminates the process ($FORCEX
    does not) but which allows proper cleanup. Currently this might mean
    invoking $EXIT for multiple access modes (and in sequence). Another
    solution might be to provide a hammer like a non-user mode rundown that
    could allow RMS to flush buffers. This would still cause problems with
    user mode (e.g. RTL) buffering. So while I agree with your DCL syntax,
    there would be other changes needed. At the same time, one would
    probably want to retain and have available at the DCL level the current
    SYS$FORCEX capability.
473.7How about a Dataset Hangup?KEIKI::WHITEMIN(2�,FWIW)Wed Apr 16 1997 15:337
    
    	Just curious but would a dataset hangup to a process which would
    normally cause the process to exit do all the right things.
    
    	Can this be forced into the process?
    
    						Bill
473.8EVMS::MORONEYHit <CTRL><ALT><DEL> to continue ->Wed Apr 16 1997 15:5119
re .6:

>    What you really want is something that terminates the process ($FORCEX
>    does not) but which allows proper cleanup.

Depends on how the verb STOP should be interpreted.  STOP (without /ID) to the
DCL prompt after a CTRL-Y just stops the current image.  STOP/ID is an
uncompromising kill, not just a stop.

But yes, a "gentle" version of STOP/ID would be useful.

> At the same time, one would
> probably want to retain and have available at the DCL level the current
> SYS$FORCEX capability.

I had a DCL level FORCEX CLD and image for a DCL $ FORCEX command.  It worked
like STOP process or STOP/ID except with an optional parameter, a status code
for FORCEX. I should dig it up.

473.9forcex.cXDELTA::HOFFMANSteve, OpenVMS EngineeringWed Apr 16 1997 16:0778
/*
** COPYRIGHT (c) 1992, 1996 BY
** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
** ALL RIGHTS RESERVED.
**
** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
** ONLY  IN  ACCORDANCE  OF  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER
** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
** OTHER PERSON.  NO TITLE TO AND  OWNERSHIP OF THE  SOFTWARE IS  HEREBY
** TRANSFERRED.
**
** THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE
** AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
** CORPORATION.
**
** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS
** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
*/

/*
**++
**  Facility:
**
**	Examples
**
**  Version: V1.0
**
**  Abstract:
**
**	Performs a $FORCEX on the specified target.  Set up to
**	be called as a foreign command.
**
**  Author:
**	Steve Hoffman
**
**  Creation Date:  1-Jan-1990
**
**  Modification History:
**--
*/

/*
/*  Example/test program that performs a $FORCEX on the specified
/*  process.  Called as a foreign command, with one argument, the
/*  hexidecimal PID of the target process.  May require GROUP or
/*  WORLD privilege.
*/

#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>

main( int argc, char **argv )
    {
    unsigned long int retstat;
    unsigned long int pid;
    unsigned long int finalstat = SS$_BUGCHECK;
    char hex[12];

    if (( argc != 2 ) && ( argc != 3 ))
	{
	printf("this is a foreign command.\n");
	printf("fx :== $ddcu:[dir]forcex\n");
	printf("usage: fx pid\n");
	printf("       fx pid exitstatus\n");
	return SS$_BADPARAM;
	}

    sscanf( argv[1], "%x", &pid );
    if ( argc == 3 )
	sscanf( argv[1], "%x", &finalstat );

    retstat = sys$forcex( &pid, 0, finalstat );

    return retstat;
    }

473.10AUSS::GARSONDECcharity Program OfficeWed Apr 16 1997 23:537
re .8
    
>I had a DCL level FORCEX CLD and image for a DCL $ FORCEX command.  It worked
>like STOP process or STOP/ID except with an optional parameter, a status code
>for FORCEX. I should dig it up.
    
    I have that. I got it from John Gillings.
473.11Freeware CDWKRP::16.72.96.42::KIERMy Grandchildren are the NRA!Thu Apr 17 1997 21:584
There is also the KILL program/verb on the Freeware CD which has an option
for /FORCE as well as some other nice features.

	Mike