EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: [Merge] lp:~ralph-lange/epics-base/cac-dtor-racecond-fix into lp:epics-base
From: Ralph Lange <[email protected]>
To: [email protected]
Date: Mon, 23 Aug 2010 20:26:17 -0000
Ralph Lange has proposed merging lp:~ralph-lange/epics-base/cac-dtor-racecond-fix into lp:epics-base.

Requested reviews:
  EPICS Core Developers (epics-core)


While the cac dtor runs and waits for TCP circuit threads to exit,
new circuits could be opened by name resolution replies on existing
(still active) circuits.

Avoid this by setting a flag (lock being held) in the dtor, and
checking it in cac::transferChanToVirtCircuit.

-- 
https://code.launchpad.net/~ralph-lange/epics-base/cac-dtor-racecond-fix/+merge/33449
Your team EPICS Core Developers is requested to review the proposed merge of lp:~ralph-lange/epics-base/cac-dtor-racecond-fix into lp:epics-base.
=== modified file 'src/ca/cac.cpp'
--- src/ca/cac.cpp	2010-08-16 23:45:06 +0000
+++ src/ca/cac.cpp	2010-08-23 20:26:17 +0000
@@ -146,7 +146,8 @@
     maxRecvBytesTCP ( MAX_TCP ),
     maxContigFrames ( contiguousMsgCountWhichTriggersFlowControl ),
     beaconAnomalyCount ( 0u ),
-    iiuExistenceCount ( 0u )
+    iiuExistenceCount ( 0u ),
+    cacShutdownInProgress ( false )
 {
 	if ( ! osiSockAttach () ) {
         throwWithLocation ( caErrorCode (ECA_INTERNAL) );
@@ -282,7 +283,10 @@
         epicsGuard < epicsMutex > guard ( this->mutex );
         if ( this->pudpiiu ) {
             this->pudpiiu->shutdown ( cbGuard, guard );
-    
+
+            // make sure no new tcp circuits are created
+            this->cacShutdownInProgress = true;
+
             //
             // shutdown all tcp circuits
             //
@@ -576,6 +580,13 @@
     epicsGuard < epicsMutex > guard ( this->mutex );
 
     /*
+     * Do not open new circuits while the cac is shutting down
+     */
+    if ( this->cacShutdownInProgress ) {
+        return;
+    }
+
+    /*
      * ignore search replies for deleted channels
      */
     nciu * pChan = this->chanTable.lookup ( cid );

=== modified file 'src/ca/cac.h'
--- src/ca/cac.h	2010-08-10 21:05:46 +0000
+++ src/ca/cac.h	2010-08-23 20:26:17 +0000
@@ -283,6 +283,7 @@
     unsigned beaconAnomalyCount;
     unsigned short _serverPort;
     unsigned iiuExistenceCount;
+    bool cacShutdownInProgress;
 
     void recycleReadNotifyIO ( 
         epicsGuard < epicsMutex > &, netReadNotifyIO &io );


Navigate by Date:
Prev: [Merge] lp:~ralph-lange/epics-base/msi-join into lp:epics-base Ralph Lange
Next: Re: msi again Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: [Merge] lp:~ralph-lange/epics-base/msi-join into lp:epics-base Ralph Lange
Next: Re: msi again Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·