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

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1713.0. "QUERY: How does a control-c get propagated?" by COOKIE::KITTELL (Richard - Architected Info Mgmt) Thu Oct 24 1991 17:26

        How are canceled requests being handled? I know such things
        are the bane of distributed systems, but we gotta do them,
        so... take the following scenario:

                ANODE

        +--------------------------+
        | MCC>verb class instance  |
        |                          |
        |        P5AM              |              GRID
        |                          |             
        +--------------------------+        +---------------+
                     |                      |  Working...   |
                     |                      |               |
                     +----------------------|               |
                                            |               |
                                            +---------------+


        A directive has been issued on node ANODE to the DECmcc FCL
        PM. The directive has been dispatched to the Phase V Access
        Module and encoded in CMIP, then passed to the listener, agent
        and MOM on node GRID.  The P5AM on ANODE is waiting for a
        reply.
        
        The MOM on GRID is working on it, and in fact has reached a
        point where it is waiting for some human on or around GRID to
        do something before it can complete. That human, being human,
        isn't going to get around to it today.

        Our person on ANODE has tired of waiting and hits control-c.
        The DECmcc runtime catches the control-c and terminates all
        the blocked runtime calls with a thread_alert status.

        Assuming I've got it right so far, what happens next? Our hope
        is that the MOM on GRID has some way of being told
        "nevermind". I realize DECmcc owns only part of the solution.
        But if I can learn what will happen on ANODE I can post an
        updated version of this question in the common agent
        conference, and find out what happens on GRID.

        Thanks,

        Richard
T.RTitleUserPersonal
Name
DateLines
1713.1TOOK::PURRETTAFri Nov 22 1991 17:397
    When the PhaseV am receives a termination request (cancel)
    it terminates the link and returns. (IO$_DEACCESS+IO$M_SYNCH QIO,
    and deassign of the channel on VMS, close of the socket on Ultrix).
    It's up to the other end to detect that the connection went away
    and handle it.


1713.2Thanks.COOKIE::KITTELLRichard - Architected Info MgmtMon Nov 25 1991 10:180
1713.3Another control-c questionMICROW::LANGMon Feb 10 1992 11:3918
    
    	Along those lines, we have an  AM which uses DCE/RPC to send
    	requests to a management agent.
    
    	I thought that if a user was issuing a directive which did not
    	have multiple replies, that even though the control-c was issued
    	it would essentially be "ignored", since there is not NEXT request
    	on which to set the handle to CANCEL. Would a Control-c work this
    	way?  From one of the earilier notes, it sounds like it might
    	terminate the blocked runtime call (which would be the rpc call.)
    
    	For some directives, our AM itself is the management agent, and
    	makes SQL calls.  If a cancel comes in, is there a chance that
    	it would be propagated to the  SQL call?
    
    	Thanks for your help.
    
    			Bonnie
1713.4SQL thread safe?TAEC::SILVACarl Silva - Telecom Eng - DTN 828-5339Mon Feb 10 1992 12:169
>    	For some directives, our AM itself is the management agent, and
>    	makes SQL calls.  If a cancel comes in, is there a chance that
>    	it would be propagated to the  SQL call?

	For this do you use ULTRIX/SQL or Rdb?  Is the API for Rdb thread safe? 
The API for ULTRIX/SQL is not thread safe and you have to either protect it
with a lock or execute it in a seperate process.

	Carl
1713.5Control C == mcc_thread_send_alertMOLAR::ROBERTSKeith Roberts - DECmcc Toolkit TeamTue Feb 11 1992 07:3853
  Bonnie,

  When the FCL sees you type the Control-C, it sends an Thread Termination
  Alert to the thread which is executing the current FCL directive.

  The Thread PC could be anywhere ...

	o In the DECmcc Information Manager / Dispatcher (waiting for the
	  scheduled time)
	o In your AM code
	o In a DECmcc Common Routine
	o In an O/S runtime routine ... such as SYS$QIOW

  The MCC_S_ALERT_TERMREQ status can only be returned from a DECmcc Common
  Routine.


  <<< Synthesizing the MCC_S_ALERT_TERMREQ >>>

  In some cases you have to translate a specific O/S type of error condition
  into the MCC_S_ALERT_TERMREQ yourself.  For Example, if the PC was sitting
  at a SYS$QIOW ... and the thread was sent an Alert, the QIO would abort
  and return the SS$_ABORT code in the I/O Status Block.  You would have
  to test for this and translate the code to the MCC_S_ALERT_TERMREQ.

  In other cases, you may have to put a wrapper around a piece of code.
  You may need to defer and the restore the Alert mechanism ... then Test
  to see if the thread has been Alerted to Terminate (mcc_thread_test_alert).


  <<< The Call Handle and Thread Termination >>>

  As far as the DECmcc Call Handle argument;  If you can cleanup properly
  from the MCC_S_ALERT_TERMREQ, then you can re-initialize (mcc_ahs_reinit)
  and return the CVR directly to the caller.  The caller should test for
  the CVR and realize the call has been terminated, then test the Handle.
  Because you reinit'd the Handle, it will not be "more" and the call is done.

  If you choose not (or cannot) clean up, you must set the Handle to "more"
  and return the MCC_S_ALERT_TERMREQ.  The caller should test for the CVR,
  and then check the Handle.  If the Handle is "more" - the call must set it
  to cancel and recall your MM ... you see the Handle is set to "cancel" and
  clean up.


  A bit long-winded, but I hope it helps ... 8)

  /keith  

  

  
1713.6More on 1713.3MICROW::LANGTue Feb 11 1992 08:5222
    RE: 1713.4
    >For this do you use ULTRIX/SQL or Rdb?  Is the API for Rdb thread safe?
    >The API for ULTRIX/SQL is not thread safe and you have to either
    >protect it with a lock or execute it in a seperate process.
               
    We are using both ULTRIX/SQL and Rdb for VMS. I don't think Rdb is
    thread safe, and we are planning to protect both implementations with
    a lock.  Thanks for the input
    
    RE: 1713.5
    
    This helps a lot, I didn't realize this is the way it worked. 
    Does anyone know how if thread alert is handled if the code is
    executing an SQL call within the same thread?
   
    I'm also wondering about how the alert is handling if the code is
    in the middle of a DCE/RPC call.  Is the thread alert a cma mechanism? 
    If so, then I would think the DCE/RPC would get notification of this.
    
    	thanks a lot.
    
    			Bonnie
1713.7TOOK::SWISTJim Swist LKG2-2/T2 DTN 226-7102Tue Feb 11 1992 08:579
    The rpc operation is alertable, but what rpc does with the alert you'll
    have to ask them.  If they do nothing to catch it then it will
    propogate back up the call stack until it finds a handler (like in your
    code).  If it finds not the thread will be killed.
    
    SQL is not integrated with CMA, its I/O is all process blocking
    and non-alertable.  The alert will therefore have no affect on the
    operation.  You will have to test for the alert yourself.
    
1713.8Yah but...TAEC::SILVACarl Silva - Telecom Eng - DTN 828-5339Tue Feb 11 1992 11:3425
	RE: .6,

>    We are using both ULTRIX/SQL and Rdb for VMS. I don't think Rdb is
>    thread safe, and we are planning to protect both implementations with
>    a lock.  Thanks for the input

	Yes, I would use ther same technique for ULTRIX/SQL if you link the API
with your AM.

	RE: .7,

>    SQL is not integrated with CMA, its I/O is all process blocking
>    and non-alertable.  The alert will therefore have no affect on the
>    operation.  You will have to test for the alert yourself.

	Yes, this is true since SQL uses its own ULTRIX I/O statements that
were not interpreted by the SQL pre-compiler and therefore are blocking (for
example, the real select is used instead of cma_select).  So the alert will not
work while your AM is making an SQL call and you will have to check after for
the alert.

	Or you can put the interface to SQL in another process which is a lot
of fun on its own if you have the time and patience....  8-)

	Carl
1713.9sys$qiow - ss$_abort is a hint that an alert may be pendingTOOK::BURGESSThu Feb 13 1992 13:2811
re .5  is slightly wrong is one respect on VMS.

	if sys$qiow returns ss$_abort or ss$_cancel, (or smg_... returns whatever
	it returns when sys$qiow returns ss$_abortor ss$_cancel), then the multi-threaded
	client is merely given a *hint* that there might be (probably is) a "pending-alert"
	and the client *should* then explicitly test for a pending alert
	(mcc_thread_test_alert()).

	The modified thread-safe version of sys$qiow, catches any pending alert,
	cancels the current i/o, sends another alert to the current thread, and
	returns with the iosb status.