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

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:[email protected], 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3564.0. "Woodward Associates - Point 27090" by RDGENG::ASAP () Wed Apr 30 1997 06:36

    Company Name :  Woodward Associates - Point 27090
    Contact Name :  Roger Woodward
    Phone        :  01628 666083
    Fax          :  01628 666083
    Email        :  [email protected]
    Date/Time in :  30-APR-1997 10:35:44
    Entered by   :  Hartmut Becker
    SPE center   :  REO

    Category     :  vms
    OS Version   :  
    System H/W   :  


    Brief Description of Problem:
    -----------------------------

From:	RDGENG::MRGATE::"RDGMTS::PMDF::mail.dec.com::LennonD" 29-APR-1997 15:27:43.58
To:	RDGENG::ASAP
CC:	
Subj:	ESCALATION: POINT  , Company  TO ASAP READING:

From:	NAME: Declan Lennon <[email protected]@PMDF@INTERNET>
To:	NAME: '[email protected]' <IMCEAX400-c=US+3Ba=+20+3Bp=DIGITAL+3Bo=SBUEURMFG+3Bdda+3ASMTP=asap+40reo+2Emts+2Edec+2Ecom+3B@mail.dec.com@PMDF@INTERNET>

Hello -

POINT Log Number	 27090
Company Name 	Woodward Associates
Engineers name	Roger Woodward
Telephone Number 	01628 666083
Fax Number		01628 666083
E-mail Address	[email protected]

Operating System, Version	VMS & UNIX
Platform			VAX & Alpha

Problem Statement		


From:  Roger Woodward[SMTP:[email protected]]
Sent:  29 April 1997 06:38
To:  asap_euro
Subject:  help please

Company name: Woodward Associates (UK) Ltd
ASAP no: A71027

Hi there,
I wonder if you can help me with this problem.

I am doing a bit of "reverse" porting. Our company product is a
client/server product that is supplied to the NHS. Among our 
customers
we have Alpha UNIX and VAX installations.
Originally we ported our product to the VAX substituting Transparent
DECNet for the TCP layer, this was fine except for the fact that it 
only
allows a one to one relationship between client and server.

We now have a new client, SMS, who require an extension to the VMS
varient so that it more matches the functionality available under 
UNIX,
vis, a many to one relationship between clients and server. Their 
client
base of about 60 sites is slowly migrating to the Alpha, but until 
then
we have to support this solution under VMS.

We have used temporary Mailboxes in place of DECNet which work fine
almost all the time. Clients talk to the server through one mailbox,
then a unique mailbox gets created for server to client communication
using the client process id to name that mailbox.

This works OK, except that the server mailbox appears to fall into a
idle state after a period of inactivity, after which the first 
request
from a client times out (for example, the first connect attempt in 
the
morning). Is this likely? Do mailboxes hibernate or fall into some 
kind
of idle state automatically? If so is there a system call I should 
use
that would ensure they are in an active state?

The timeout does not always happen, so the first call in the morning 
may
sometimes work, there is a small amount of evidence that it may be
linked to system loading, but this may be mere conjecture.

Obviously there are work arounds we can employ, but I would rather 
try
and understand what may be going on and implement it correctly.

The system is implemented as follows:
User application in MUMPS (or test application in Basic)
Interface library in C
Client Transport layer in C
Server Transport layer and application in C/C++


I hope this makes sense, any light you could shed on this would be
greatly appreciated.

Regards
Roger
Roger Woodward
Woodward Associates (UK) Ltd
Phone/Fax: 01628 666083
e-mail: [email protected]







In replying, please use [email protected]




RFC-822-headers:
Received: from reoexc1.reo.dec.com by rg71rw.reo.dec.com (PMDF V5.0-7 #15552)
 id <[email protected]> for [email protected]; Tue,
 29 Apr 1997 10:24:16 +0100
Received: by reoexc1.reo.dec.com with SMTP
 (Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63)
 id <[email protected]>; Tue, 29 Apr 1997 10:25:35 +0100
X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
T.RTitleUserPersonal
Name
DateLines
3564.1asked for more info, gave sda hintsMUCTEC::BECKERHartmut B., VMS &amp; Languages, MunichWed Apr 30 1997 10:0596
From:	ALFAM7::BECKER "Hartmut Becker - VMS & Languages Support, Munich  30-Apr-1997 1450 +0200" 30-APR-1997 14:52:08.11
To:	NASAXP::"[email protected]"
CC:	BECKER
Subj:	temporary mailboxes, asap log number 27090

Hi Roger,

I'm sorry, from your description I can't identify any problem. I'm also not
aware of general mailbox problems in OpenVMS. If you give me some more
information I can scan our databases.

I assume your application runs on Alpha, which version of OpenVMS are you using?

What are the process states of the server and client? (LEF/HIB...?)

How do you write to and read from the mailbox, $qio or $qiow?
Do you use event flags, asts?

Do you get any status information? Return code or IOSB?

Can you re-produce the problem with a small example?

On the other hand I can give some hints how to look at the mailboxes from VMS.
You need privileges to run SDA and you need to know the mailbox number (SDA>
show process/channel can give you all open channels for the specified process,
there you should find your mailbox).

For example you can do (example from OpenVMS/Alpha V7.1):

$ anal/sys
SDA> sh dev MBA9020:
MBA9020                                        MBX                 UCB:
80EF8F40

Device status:   08000010 online,exfunc_supp
Characteristics: 0C150001 rec,shr,avl,mbx,idv,odv
                 00000200 nnm

Owner UIC [000100,000005]   Operation count         33   ORB address    80FE3F40
      PID        00000000   Error count              0   DDB address    84AA9680
Class/Type          A0/01   Reference count          1   DDT address    84AC8340
Def. buf. size        256   BOFF              00000000   CRB address    84AA96C8
DEVDEPEND        00000020   Byte count        00000000   LNM address    85DA7410
DEVDEPND2        00000000   SVAPTE            00000000   I/O wait queue 80EF8FAC
DEVDEPND3        00000000   DEVSTS            00000002
FLCK index             2C
DLCK address     84AB1E00
Charge PID       00050071

        *** I/O request queue is empty ***
SDA>
Operation count is total number of successful reads/writes
	(and some other i/os)
if the mailbox was just created you will see an operation count of 0 but there
can already be messages queued. See below, the val command shows them.

Reference count shows how many channels are assigned to this mailbox
	I assume in your case you find a 2, one channel from the server,
	another one from the client
SDA> val q UCB
Queue is complete, total of 32 elements in the queue

This shows the message blocks in the mailbox, each block represents a
	a message in the mailbox
SDA> ex @.;80
00000000 20130080 80EF8F40 80D16A00  .j�.@.�.... ....     FFFFFFFF.80C93040
00000000 00000000 00000000 7FFABED0  �...............     FFFFFFFF.80C93050
000500B4 00010021 80C93070 000500B4  ...p0�.!........     FFFFFFFF.80C93060
7074756F 24737973 20657469 72772024  $ write sys$outp     FFFFFFFF.80C93070
6B6E756A 20736920 73696874 22207475  ut "this is junk     FFFFFFFF.80C93080
4B5F4552 41575446 4F533A4F 464E4922  "INFO:SOFTWARE_K     FFFFFFFF.80C93090
00000000 00000000 0053494C 2E535449  ITS.LIS.........     FFFFFFFF.80C930A0
00000000 00000000 00000000 00000000  ................     FFFFFFFF.80C930B0

This shows the first message block
the message is appended, message size is at offset 2c
SDA> ex @.;80
...
shows the next message block (we have 32 in the queue)

@. is relative addressing, . is the current address, @. is it's contents
So the first @. only works if the UCB is the current address (which is set with
the val q UCB command. The next @. only works if no other command sets a new
current address. Here you can issue 32 ex @.;80 commands, in general as many as
elements in the queue.

Hope this helps,
Hartmut

--------------------------------------------------------------------------------
Digital Equipment GmbH
Software Partner Engineering
Hartmut Becker				[email protected]
Freischuetzstr. 91			Telefon [49](89)9591-0
D-81927 Muenchen			Telefax [49](89)9591-2220
    
3564.2his answersMUCTEC::BECKERHartmut B., VMS &amp; Languages, MunichWed May 07 1997 12:58324
From:	ALFAM7::VBORMC::"[email protected]" "Roger Woodward  07-May-1997 1501 +0200"  7-MAY-1997 15:01:06.97
To:	"Hartmut Becker - VMS & Languages Support, Munich" <[email protected]>
CC:	
Subj:	asap log number 27090

Hi Harmut

In message <[email protected]>, "Hartmut Becker -
VMS & Languages Support, Munich" <[email protected]> writes
>I'm sorry, from your description I can't identify any problem. I'm also not
>aware of general mailbox problems in OpenVMS. If you give me some more
>information I can scan our databases.

This is a more complete description of the problem.

The server once started services calls from a variable number of
clients. There appear to be no problems until the server is left alone
for a while (i.e. no clients are active), if for example the server is
left overnight. When the first call to the server takes place in the
morning, the client QIOW returns with a status of 0 having timed out
immediately (this is slightly suprising, from reading the documentation
I would have expected SS$_CANCEL to be returned).
Further requests operate normally.

>
>I assume your application runs on Alpha, which version of OpenVMS are you using?
The application is running on a clustered Vax, running openVMS v. 6.2.
We will be migrating to the Alpha in the near future.
>
>What are the process states of the server and client? (LEF/HIB...?)
The client is started up as an interactive process so will either be COM
or LEF.
The server state is LEF before and after the call by the client.
In order to replicate this problem without having to wait a couple of
hours, my colleague at SMS runs a cpu intensive program. This process
runs at the same priority as the client and server.

>
>How do you write to and read from the mailbox, $qio or $qiow?

the client
writes with $QIO
then reads with $QIOW and a timeout on the channel

the server
reads with $QIOW
then writes with $QIOW


>Do you use event flags, asts?
no
>
>Do you get any status information? Return code or IOSB?
the first client read times out with a status 0

>
>Can you re-produce the problem with a small example?
>
not yet

thanks for the advice on looking at mailboxes, we are looking at them
today.


The following is most of the client/server code for reference. The
server is built with HRGSERVER defined, the client without HRGSERVER
defined.


#ifndef HRGSERVER
/*******************************************
*   timerCallback
*
*   if the timer expires, the timer callback function is called
*   and the original qiow falls through
********************************************/
static void timerCallback(long param, long pc, long ps1, long rzero,
long rone)
{
    // cancel the I/O
    statusVMS = sys$cancel( cancelChan );
    if ( statusVMS != SS$_NORMAL )
        lib$stop( statusVMS );

#if DEBUG        
    printf("cancelling qio\n");
#endif

    timerFlag = -1;
}

/*******************************************
*   startTimer
*
*   start up timer based on parameters set up in setTimer
********************************************/
static void startTimer()
{
    statusVMS = sys$setimr(0, &binaryTime, &timerCallback, 0 );
    if ( statusVMS != SS$_NORMAL )
        lib$stop( statusVMS );
}
#endif


/*******************************************
*   ReceiveNetMsg
*
*   receive a network message
*   because mailboxes work on two channels for
*   communication, ConnFD is not used. channels
*   are maintained instead in the client list
********************************************/
extern int ReceiveNetMsg(int ConnFD, char *MsgBufPtr, int MsgBufLen)
{
    int NBytes;
    short channel;
    QIO_STATUS_BLOCK iosb;
    char clientMboxId[16];
    int status = 0;

#ifdef HRGSERVER
    channel = toServerChannel;
#else
    channel = fromServerChannel;

    // timeout mechanism for the client
    cancelChan = channel;
    startTimer();
#endif

    /* read from the server mailbox */
    /* this connection uses a timeout on the client side*/
    status = sys$qiow(2, channel, IO$_READVBLK, &iosb, 0, 0,
                      MsgBufPtr, MsgBufLen-1, 0,0,0,0);
#ifdef HRGSERVER
    if (status != SS$_NORMAL)
        lib$stop(status);
#else
    {
        int canStatus = sys$cantim(0,0);
        if (canStatus != SS$_NORMAL)
            lib$stop(canStatus);

        // timeout
        if ( timerFlag < 0 )
        {
#if DEBUG        
            printf("channel has timed out\n");
#endif
            // all channels to the server are now invalid
            lclose(toServerChannel);    
            lclose(fromServerChannel);    
            
            timerFlag = 0;
            
            statusVMS = status;
            return( MESSAGE_TIMEOUT );
        }
        if ( status != SS$_NORMAL )
            if (status == SS$_IVCHAN)
            {
                statusVMS = status;
                return( MESSAGE_TIMEOUT );
            }
            else
                lib$stop(status); 
    }
#endif

    if ((iosb.cond_value &1) != 1)
        lib$stop( iosb.cond_value );

    /* null terminate the string */
    *(MsgBufPtr+iosb.count) = '\0';

#ifdef DEBUG
    printf("message buffer <%d><%d><%s>\n",MsgBufLen,iosb.count,MsgBufPt
r);
#endif

    if (iosb.count <= 0)    /* read() error or no bytes received */
        return MESSAGE_DISCON;

#ifdef HRGSERVER
    // server now links into the given mailbox
    // first PID_LENGTH chars are the identity of the client
    memcpy( clientMboxId, MsgBufPtr, PID_LENGTH );
    *(clientMboxId + PID_LENGTH) = '\0';
    
    checkMboxID( clientMboxId );

    if (( fromServerChannel = findClient( clientMboxId )) <= 0 )
    {
        /* new connection requested from a client */
        /* compose the mailbox name 
           (i.e. replace the xxxxxxxx in AG_CLIENT_MBxxxxxxxx) */
        memcpy( (clientMailbox.dsc$a_pointer)+MBX_ID_PID_OFFSET,
                clientMboxId, PID_LENGTH );
        
        /* create the mailbox */
        if ((( statusVMS = sys$assign(&clientMailbox,
&fromServerChannel,3,0,0)) &1) !=1)
            lib$stop(statusVMS);

        /* retain client details */
        saveClient( clientMboxId, fromServerChannel );

        if ( Debug )
        {
            char buff[80];
            sprintf(buff, "server created client mailbox %s\n",
                    clientMailbox.dsc$a_pointer);
            HRGTraceStatement(1, buff);
        }
    }

    /* write over the client id in the message, the application above
       us is not interested in it */
    NBytes = iosb.count;
    if ( NBytes > PID_LENGTH )
    {
        memmove( MsgBufPtr, MsgBufPtr + PID_LENGTH, NBytes - PID_LENGTH
);
        NBytes -= PID_LENGTH;
    }
#endif

    return NBytes;
}

/*******************************************
*   SendNetMsg
*
*   send a network message
*   because mailboxes work on two channels for
*   communication ConnFD is not used. channels
*   are maintained instead in the client list
********************************************/
extern int SendNetMsg(int ConnFD, char *MsgBufPtr, int MsgLen)
{
    short channel;
    QIO_STATUS_BLOCK iosb;
#ifndef HRGSERVER
    char altMessage[MBX_SIZE + PID_LENGTH];
#endif
    int status = 0;
    statusVMS = 0;

#ifdef HRGSERVER
    channel = fromServerChannel;
#else
    channel = toServerChannel;
    if ( toServerChannel < 0 )
    {
        // timed out, try to reconnect
        if ( status = ConnectClient((char *)0, 0, 0) < 0 )
            return( status );
    }

    // add client id to the start of the message
    sprintf( altMessage, "%08.8X", getpid() );
    memcpy(altMessage+PID_LENGTH, MsgBufPtr, (MsgLen>MBX_SIZE?MBX_SIZE:M
sgLen));
#endif

    /* write message to the mailbox */
#ifdef HRGSERVER
    if (((statusVMS = sys$qiow( 1, channel, IO$_WRITEVBLK, &iosb, 0, 0,
                             MsgBufPtr, MsgLen, 0,0,0,0)) &1) != 1)
        lib$stop(statusVMS);
#else /*qio*/
    /* synchronous call to allow a timeout on the read */
    statusVMS = sys$qio( 1, channel, IO$_WRITEVBLK, &iosb, 0, 0,
                      altMessage, MsgLen+PID_LENGTH, 0,0,0,0 );
    if ( statusVMS != SS$_NORMAL )
        if (statusVMS == SS$_IVCHAN)
            return( HRG_TIMEOUT );
        else
            lib$stop(statusVMS); 
#endif

#ifdef HRGSERVER
    // following two lines removed if using qio 
    if ((iosb.cond_value &1) != 1)
        lib$stop(iosb.cond_value);

    // if this is a close message then delete the client from our list
    // and close the channel
    if ( strcmp(MsgBufPtr, UNLINK_CLIENT_RESULT) == 0)
    {
        lclose( channel );
        deleteClient( channel );
    }
#endif

    return MsgLen;
}

I hope this begins to make sense. We will continue to invetigate
further.

Regards
roger


Roger Woodward
Woodward Associates (UK) Ltd
Phone/Fax: 01628 666083
e-mail: [email protected]

% ====== Internet headers and postmarks (see DECWRL::GATEWAY.DOC) ======
% Received: from mail.vbo.dec.com (mail.vbo.dec.com [16.36.208.34]) by vbormc.vbo.dec.com (8.7.3/8.7) with ESMTP id OAA00307 for <[email protected]>; Wed, 7 May 1997 14:49:09 +0200
% Received: from server21.digital.fr (server21.digital.fr [193.56.15.21]) by mail.vbo.dec.com (8.7.3/8.7) with ESMTP id PAA19288 for <[email protected]>; Wed, 7 May 1997 15:01:10 +0200 (MET DST)
% Received: from punt-1.mail.demon.net (relay-7.mail.demon.net [194.217.242.9]) by server21.digital.fr (8.7.5/8.7) with SMTP id PAA27436 for <[email protected]>; Wed, 7 May 1997 15:06:44 +0200 (MET DST)
% Received: from wyvis.demon.co.uk ([194.222.115.157]) by punt-1.mail.demon.net id aa0528663; 7 May 97 13:14 BS
% Message-ID: <[email protected]>
% Date: Wed, 7 May 1997 13:10:22 +0100
% To: "Hartmut Becker - VMS & Languages Support, Munich" <[email protected]>
% From: Roger Woodward <[email protected]>
% Subject: asap log number 27090
% MIME-Version: 1.0
% X-Mailer: Turnpike Version 3.01 <Rxlf5iwdh9IDwWvFxPqf08oxz1>
    
3564.3my replyMUCTEC::BECKERHartmut B., VMS &amp; Languages, MunichWed May 07 1997 12:5957
From:	ALFAM7::BECKER "Hartmut Becker - VMS & Languages Support, Munich  07-May-1997 1754 +0200"  7-MAY-1997 17:56:25.59
To:	VBORMC::"[email protected]"
CC:	BECKER
Subj:	re: asap log number 27090

Hi Roger,

>>I'm sorry, from your description I can't identify any problem. I'm also not
>>aware of general mailbox problems in OpenVMS. If you give me some more
>>information I can scan our databases.
>
>This is a more complete description of the problem.
>
>The server once started services calls from a variable number of
>clients. There appear to be no problems until the server is left alone
>for a while (i.e. no clients are active), if for example the server is
>left overnight. When the first call to the server takes place in the
>morning, the client QIOW returns with a status of 0 having timed out
>immediately (this is slightly suprising, from reading the documentation
>I would have expected SS$_CANCEL to be returned).
>Further requests operate normally.

I'm not sure if I really understand the description. I try to:  $QIO shouldn't
return a status of 0 (which means %NONAME-W-NOMSG). It also shouldn't return
SS$_CANCEL. The IOSB can have these values. Hence I assume you are talking
about the IOSB.

As far as I know the IOSB is cleared at the beginning of the QIO, that is its
status is set to 0. Then the QIO is processed or if it can't be processed
control is returned to the caller with a return status. The returned status
is something like SS$_NORMAL, SS$_ABORT, SS$_EXQUOTA, etc.

Does it make sense?

>thanks for the advice on looking at mailboxes, we are looking at them
>today.

I thought you were on Alpha, some offsets may be different on VAX but the
procedure to look at the data should be the same.

I looked at the sources. To be honest it looks complex with the #ifdefs for the
client and the server. Can you point me to the location where you get the
(IOSB-) status 0? On the other hand you issue one qio without wait (although
the comment says 'synchronous'). Where do you check/wait for completion of this
qio? As far as I see from the source extract you only check the return code of
the queueing.

Regards
Hartmut

--------------------------------------------------------------------------------
Digital Equipment GmbH
Software Partner Engineering
Hartmut Becker				[email protected]
Freischuetzstr. 91			Telefon [49](89)9591-0
D-81927 Muenchen			Telefax [49](89)9591-2220