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: RE: Fixed: Segfaults in 3.14 branch since merging ca-over-tcp
From: "Jeff Hill" <[email protected]>
To: "'Ralph Lange'" <[email protected]>, "'Andrew Johnson'" <[email protected]>
Cc: "'EPICS Core Talk'" <[email protected]>
Date: Mon, 16 Aug 2010 16:57:27 -0600
> which I think is a bug in CAC.

Actually, looking at the diffs (using windiff) it would appear that the issue was introduced by a conflict between the fix for Mantis 334 (revision 11805 of cac.cpp) and the TCP name resolver merge (revision 12092 of cac.cpp). Unfortunately, mantis 334 was fixed after the TCP name resolver upgrade was written. In particular, code in cac::transferChanToVirtCircuit was repackaged into the smaller cac::findOrCreateVirtCircuit and somehow this decisive line in cac::transferChanToVirtCircuit was discarded by the merge.

	this->serverTable.add ( *pnewiiu );
	this->circuitList.add ( *pnewiiu );
	this->iiuExistenceCount++; <=========== omitted
	pBHE->registerIIU ( guard, *pnewiiu );

Jeff
______________________________________________________
Jeffrey O. Hill           Email        [email protected]
LANL MS H820              Voice        505 665 1831
Los Alamos NM 87545 USA   FAX          505 665 5107

Message content: TSPA

> -----Original Message-----
> From: Ralph Lange [mailto:[email protected]]
> Sent: Monday, August 16, 2010 10:03 AM
> To: Andrew Johnson
> Cc: Jeff Hill; EPICS Core Talk
> Subject: Fixed: Segfaults in 3.14 branch since merging ca-over-tcp
> 
>   Hi Andrew,
> 
> it looks as I have found the reason for the segfaults, which I think is
> a bug in CAC.
> 
> In the cac::~cac() destructor, a private member
> "this->iiuExistenceCount" is used to determine if cac should wait for
> TCP threads to shutdown. While this counter gets correctly decreased in
> cac::destroyIIU(), it never gets increased or set (except initialized to
> 0 in the cpp constructor).
> 
> So cac::~cac() was never waiting for the TCP threads to shutdown, and
> happily kept tearing down the timer/mutex infrastructure. If the threads
> were not fast enough, they were hitting on destroyed semaphores when
> cancelling their watchdog timers - that was causing the exceptions and
> segfaults.
> 
> This one-line fix will take care of the problem:
> 
> 
> === modified file 'src/ca/cac.cpp'
> --- src/ca/cac.cpp      2010-04-15 21:06:16 +0000
> +++ src/ca/cac.cpp      2010-08-16 15:24:13 +0000
> @@ -287,6 +287,7 @@
>               //
>               // shutdown all tcp circuits
>               //
> +            this->iiuExistenceCount = this->circuitList.count();
>               tsDLIter < tcpiiu > iter = this->circuitList.firstIter ();
>               while ( iter.valid() ) {
>                   // this causes a clean shutdown to occur
> 
> 
> Maybe it actually takes care of several shutdown related issues...
> 
> Yay!
> Ralph



References:
Fixed: Segfaults in 3.14 branch since merging ca-over-tcp Ralph Lange

Navigate by Date:
Prev: Re: FW: Fixed: Segfaults in 3.14 branch since merging ca-over-tcp Andrew Johnson
Next: RE: Fixed: Segfaults in 3.14 branch since merging ca-over-tcp Jeff Hill
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: Re: Fixed: Segfaults in 3.14 branch since merging ca-over-tcp Andrew Johnson
Next: RE: Fixed: Segfaults in 3.14 branch since merging ca-over-tcp Jeff Hill
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 ·