Experimental Physics and Industrial Control System
Hi everyone
I have recently run into a problem when trying to get
the CA client library (from EPICS relase 3.14.9) going
on a VxWorks6.4 (mv5100) platform.
I run through the normal sequence of creating a context,
searching for the channel of interest, getting a value.
This all works fine and I can sit in a loop for hours
periodically printing out a value...
Then I try to close things down. First I destroy the
channel via 'ca_clear_channel'. This returns normal
status. It's the subsequent call to 'ca_context_destroy'
that has the problem. This results in the following
message being printed on the console:
"Unhandled C++ exception resulted in call to terminate"
Here's what I have done in (so far fruitless) attempts
to resolve the problem:
1. I thought it might be something to do with the priority of
the kernel task that runs the shell relative to that of the
tasks that handle the network so I tried running my test
function in a low priority task spawned from the shell.
No improvement.
2. Initially I used the ca_disable_preemptive_callback
threading model. I tried the preemptive threading
model instead. No improvement.
3. I rebuilt the CA library with debug symbols enabled. I then
fired up the Windriver workbench and delved into the call
into the CA client code. Execution proceeded normally in
the ca_context_destroy_code until the point marked
"OUCH" !
void epicsShareAPI ca_context_destroy ()
{
ca_client_context *pcac;
if ( caClientContextId != NULL ) {
pcac = (ca_client_context *) epicsThreadPrivateGet
( caClientContextId );
if ( pcac )
{
delete pcac; // <---- OUCH !!
epicsThreadPrivateSet ( caClientContextId, 0 );
}
}
}
I followed the call into the ca_client_context destructor
and did identify the line there that was causing the problem.
But presumably the problem occurs due to my usage of the
library or the way I have built it.
4. I have examined the options I used for building the library
but nothing jumps out at me.
I am attaching my test code together with the test journal.
Many thanks for any suggesions - I am probably missing something
obvious !
Simon Rees
PSI Controls Group
#include "cadef.h"
#include <stdio.h>
/* Note: the type of an EPICS motor .RVAL field is DBF_LONG */
#define MY_TEST_PV "PTEST-NCS-SC22:MOTOR.RVAL"
void simon_ca_test()
{
chid myID;
long value;
int status;
printf( "\n\nChannel access test function starting...\n\n");
/* Initialise the context */
printf( "Calling 'ca_context_create'... ");
status = ca_context_create( ca_enable_preemptive_callback );
if ( status != ECA_NORMAL )
{
printf( "\nERROR: call to 'ca_context_create' failed'\n\n" );
return;
}
printf( "ok.\n");
/* Buffer a create channel request */
printf( "Calling 'ca_create_channel'... ");
status = ca_create_channel ( MY_TEST_PV, NULL, NULL, CA_PRIORITY_DEFAULT, &myID );
if ( status != ECA_NORMAL )
{
printf( "\nERROR: call to 'ca_create_channel' failed'\n\n" );
return;
}
printf( "ok.\n");
/* Send create channel request to network*/
printf( "Calling 'ca_pend_io'... ");
status = ca_pend_io( 5.0 );
if ( status != ECA_NORMAL )
{
printf( "\nERROR: call to 'ca_pend_io' failed'\n\n" );
return;
}
printf( "ok.\n");
/* Buffer a get value request. */
printf( "Calling 'ca_get'... ");
ca_get( DBR_LONG, myID, &value );
printf( "ok.\n");
/* Send get value request to network */
printf( "Calling 'ca_pend_io'... ");
status = ca_pend_io( 5.0 );
if ( status != ECA_NORMAL )
{
printf( "\nERROR: call to 'ca_pend_io' failed'\n\n" );
return;
}
printf( "ok.\n");
/* Display received value */
printf( "Returned value was: %d\n", value );
/* Clear down the channel */
printf( "Calling 'ca_clear_channel'... ");
status = ca_clear_channel( myID );
if ( status != ECA_NORMAL )
{
printf( "\nERROR: call to 'ca_clear_channel' failed'\n\n" );
return;
}
printf( "ok.\n");
/* Destroy the context */
printf( "Calling 'ca_context_destroy'... \n\n");
ca_context_destroy();
printf( "ok.\n\n");
/* Print test successful message */
printf( "Test completed ok.\n\n" );
} // simon_ca_test
->
-> sp simon_ca_test
Task spawned: id = 0x2523e20, name = t5
value = 38944288 = 0x2523e20
->
Channel access test function starting...
Calling 'ca_context_create'... ok.
Calling 'ca_create_channel'... ok.
Calling 'ca_pend_io'... ok.
Calling 'ca_get'... ok.
Calling 'ca_pend_io'... ok.
Returned value was: 1234
Calling 'ca_clear_channel'... ok.
Calling 'ca_context_destroy'...
0x2523e20 (t5): Unhandled C++ exception resulted in call to terminate
- Navigate by Date:
- Prev:
RE: medm and scalable fonts Adams, Billy R. (LARC-D401B)[RAYTHEON TECHNICAL SERVICES CO]
- Next:
Re: Creating Zombies with epicsThreadExitMain Michael Abbott
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
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: medm and scalable fonts Adams, Billy R. (LARC-D401B)[RAYTHEON TECHNICAL SERVICES CO]
- Next:
Queensgate NPS3*** series piezo controller Pedersen, UK (Ulrik)
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
<2008>
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024