EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: read waveform data using ca_create_subscription
From: Bruce Hill <[email protected]>
To: 吴煊 <[email protected]>, tech-talk <[email protected]>
Date: Tue, 4 Nov 2014 15:08:48 -0800
Hi Xuan,
If you run your program directly, without gdb, does it show
a CA.Client.Exception w/ Context of "ca_search"?

If so, that's the result of the SEVCHK macro that calls ca_pend_io
throwing an exception because one of the PV's didn't connect.
I'm not sure why gdb shows that location in the backtrace, but
I saw the same thing w/ both gdb and valgrind.    Possibly something
to do with that being the next line of code to execute if the exception
hadn't been thrown.

It you're not getting a Context of "ca_search", please send the full
output message.

Cheers,
- Bruce

On 10/30/2014 06:06 PM, 吴煊 wrote:
Hi All,

    I write a simple CA program to read waveform data. If I monitor less than 41 waveform PVs(100 elements of float type and 25Hz scan rate), it works fine. If I monitor 42 or more(modify "CH_NUM" in archive.c), then segmentation fault occured. I used gdb to debug it.
(gdb) bt
#0  ca_element_count (pChan=0x31346677) at ../oldChannelNotify.cpp:634
#1  0x0000000000400fe3 in main (argc=<value optimized out>, argv=<value optimized out>) at archive.c:138
(gdb) where
#0  ca_element_count (pChan=0x31346677) at ../oldChannelNotify.cpp:634
#1  0x0000000000400fe3 in main (argc=<value optimized out>, argv=<value optimized out>) at archive.c:138
(gdb) l
629	/*
630	 * ca_element_count ()
631	 */
632	arrayElementCount epicsShareAPI ca_element_count ( chid pChan )
633	{
634	    epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () );
635	    return pChan->io.nativeElementCount ( guard );
636	}
637	
638	/*

It seems that there is something wrong with "ca_element_count" and "epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () );"
Then I used fixed count number 100 instead of using "ca_element_count", segment fault as well.
(gdb) bt
#0  ca_create_subscription (type=16, count=100, pChan=0x31346677, mask=5, pCallBack=0x401250 <monitor>, pCallBackArg=0x7fffc71f9470, monixptr=0x0) at ../oldChannelNotify.cpp:560
#1  0x0000000000400fd9 in main (argc=<value optimized out>, argv=<value optimized out>) at archive.c:141
(gdb) l
555	    if ( mask & ~maskMask ) {
556	        return ECA_BADMASK;
557	    }
558	
559	    try {
560	        epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () );
561	        try {
562	            // if this stalls out on a live circuit then an exception
563	            // can be forthcoming which we must ignore (this is a
564	            // special case preserving legacy ca_create_subscription

I guess there is something to do with "epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () );"  However, I don't know whether my code having bug or something else wrong. Any help will be appreciate

I'm using RedHat 6.5_x64 and EPICS base 3.14.12.1

Cheers

Xuan Wu
IHEP

--
Bruce Hill
Member Technical Staff
SLAC National Accelerator Lab
2575 Sand Hill Road M/S 10
Menlo Park, CA  94025


References:
read waveform data using ca_create_subscription 吴煊

Navigate by Date:
Prev: RE: Compiling SDDS problem Anderson, Janet B.
Next: Re: Sequencer: are variables shared? Damiano Bortolato
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: read waveform data using ca_create_subscription 吴煊
Next: Re: Re: read waveform data using ca_create_subscription 吴煊
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·