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