EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  <20002001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  <20002001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CA error #2 and #48
From: Geoff Savage <[email protected]>
To: Jeff Hill <[email protected]>
Cc: tech-talk <[email protected]>
Date: Tue, 22 Feb 2000 14:43:48 -0600
We're using R3.13.1.  I looked in iocinf.c at line 1479.  Here's the function.  The messages I
reported are coming out while I'm trying to connect a channel.  Eventually the connect request times
out.  Why does the server want to free resources associated with a client connection?

void cac_close_ioc (IIU *piiu)
{
        caAddrNode      *pNode;
        ciu             chix;
        int             status;
        unsigned        chanDisconnectCount;

        /*
         * dont close twice
         */
        assert (piiu->sock_chan!=INVALID_SOCKET);

        LOCK;

        ellDelete (&iiuList, &piiu->node);

        /*
         * attempt to clear out messages in recv queue
         */
        (*piiu->procInput) (piiu);


        if (piiu == piiuCast) {
                piiuCast = NULL;
                chanDisconnectCount = 0u;
        }
        else {
                ciu     pNext;

                chanDisconnectCount = ellCount(&piiu->chidlist);

                /*
                 * remove IOC from the beacon hash table
                 */
                pNode = (caAddrNode *) piiu->destAddr.node.next;
                assert (pNode);
                removeBeaconInetAddr (&pNode->destAddr.in);

                chix = (ciu) ellFirst(&piiu->chidlist);
                while (chix) {
                        pNext = (ciu) ellNext(&chix->node);
                        cacDisconnectChannel (chix);
                        chix = pNext;
                }
        }

        if (fd_register_func) {
                (*fd_register_func) ((void *)fd_register_arg, piiu->sock_chan, F
ALSE);
        }

        status = socket_close (piiu->sock_chan);
        assert (status == 0);

        /*
         * free message body cache
         */
        if (piiu->pCurData) {
                free (piiu->pCurData);
                piiu->pCurData = NULL;
                piiu->curDataMax = 0;
        }

        piiu->sock_chan = INVALID_SOCKET;

        if (chanDisconnectCount) {
1479 ==>                genLocalExcep (ECA_DISCONN, piiu->host_name_str);
        }

        free (piiu);

        UNLOCK;
}

Here's what I see.  chanDisconnectCount is non-zero.

        if (piiu == piiuCast) {       <====== piiu is not equal to piiuCast other wise
chanDisconnectCount = 0u
                piiuCast = NULL;
                chanDisconnectCount = 0u;
        }

chanDisconnectCount gets set here.
                chanDisconnectCount = ellCount(&piiu->chidlist);
ellCount returns the number of nodes that are found in a list.

So there are still nodes in the list.  Why should this be an error?


Jeff Hill wrote:

> Geoff,
>
> The second part of the message which is varying between "No such file or directory",
> and "Address already in use" is generated directly from the socket library errno
> in the client process. These messages directly map to socket library error numbers
> 2 and 48 respectively. Sometimes there are problems because CA has accessed
> some other function in the C run time library in-between the spot in the source
> code where the problem occurred and where CA reports the error, and therefore
> the errno variable might be overwritten. In this situation I don't see this mechanism
> in play. Without knowing more about which operating system you are running on or
> what version of EPICS is running it is difficult to comment further.
>
> Jeff
>
> PS: I have attached the source code that is involved.
>
>                 status = connect(
>                                 piiu->sock_chan,
>                                 &pNode->destAddr.sa,
>                                 sizeof(pNode->destAddr.sa));
>                 if (status == 0) {
>                         break;
>                 }
>
>                 errnoCpy = SOCKERRNO;
>                 if (errnoCpy==SOCK_EISCONN) {
>                         /*
>                          * called connect after we are already connected
>                          * (this appears to be how they provide
>                          * connect completion notification)
>                          */
>                         break;
>                 }
>                 else if (
>                         errnoCpy==SOCK_EINPROGRESS ||
>                         errnoCpy==SOCK_EWOULDBLOCK /* for WINSOCK */
>                         ) {
>                         /*
>                          * The  socket  is   non-blocking   and   a
>                          * connection attempt has been initiated,
>                          * but not completed.
>                          */
>                         UNLOCK;
>                         return;
>                 }
>                 else if (errnoCpy==SOCK_EALREADY) {
>                         UNLOCK;
>                         return;
>                 }
> #ifdef _WIN32
>                 /*
>                  * including this with vxWorks appears to
>                  * cause trouble
>                  */
>                 else if (errnoCpy==SOCK_EINVAL) { /* a SOCK_EALREADY alias used by early WINSOCK */
>                         UNLOCK;
>                         return;
>                 }
> #endif
>                 else if(errnoCpy==SOCK_EINTR) {
>                         /*
>                          * restart the system call if interrupted
>                          */
>                         continue;
>                 }
>                 else {
>                         TAG_CONN_DOWN(piiu);
>                         UNLOCK;
>                         ca_printf(
>         "CAC: Unable to connect port %d on \"%s\" because %d=\"%s\"\n",
>                                 ntohs(pNode->destAddr.in.sin_port),
>                                 piiu->host_name_str, errnoCpy,
>                                 SOCKERRSTR);
>                         return;
>                 }
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]]
> > Sent: Tuesday, February 22, 2000 12:51 PM
> > To: tech-talk
> > Subject: CA error #2 and #48
> >
> >
> > Hi,
> >
> > Would someone please explain when CA feels it should spit out these
> > error messages.
> >
> > ..................................................................
> > CAC: Unable to connect port 5064 on "d0olctl03.fnal.gov:5064" because
> > 2="No such file or directory"
> > CA.Client.Diagnostic..............................................
> >     Message: "Network connection lost"
> >     Severity: "Warning" Context: "d0olctl03.fnal.gov:5064"
> >     Source File: ../iocinf.c Line Number: 1479
> > ..................................................................
> >
> >
> > ..................................................................
> > CAC: Unable to connect port 5064 on "d0olctl03.fnal.gov:5064" because
> > 48="Address already in use"
> > CA.Client.Diagnostic..............................................
> >     Message: "Network connection lost"
> >     Severity: "Warning" Context: "d0olctl03.fnal.gov:5064"
> >     Source File: ../iocinf.c Line Number: 1479
> > ..................................................................
> >
> > Thanks
> >
> > Geoff
> >



Replies:
RE: CA error #2 and #48 Jeff Hill
References:
RE: CA error #2 and #48 Jeff Hill

Navigate by Date:
Prev: Re: Problems with messages... Pete R. Jemian
Next: Re: Problems with messages... Steve Lewis
Index: 1994  1995  1996  1997  1998  1999  <20002001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: CA error #2 and #48 Jeff Hill
Next: RE: CA error #2 and #48 Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  <20002001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·