Is it possible that the "too many open files" has nothing to do with
CA, but is rather due to not properly closing the text files you open?
Mark
________________________________
From: [email protected] on behalf of Bertrand H.J. Biritz
Sent: Sat 7/5/2008 9:13 PM
To: [email protected]
Subject: CAC: unable to create virtual circuit b/c "Too many open
files"
Dear Tech-talk,
I wrote a monitoring program using some of the example code from
EPICS-
BASE and the lecture videos. It connects to an IOC every 5 minutes for
12 PV's and write their values to a text file.
The only problem is that it eventually fails with the following error
message:
epicsSocketEnablePortUseForDatagramFanout: unable to set SO_REUSEADDR?
epicsSocketDestroy: failed to close a socket because "Bad file
descriptor"
CAC: unable to create virtual circuit because "Too many open files"
the last line is repeated multiple times.
Now the relevant code snippet is:
while(1)
{
...
...
...
/*
* Here is where the CA calls happen
*/
/* Initialize */
status=ca_context_create(ca_disable_preemptive_callback);
if(status != ECA_NORMAL)
{
printf("ca_context_create failed:\n%s\n",ca_message(status));
exit(1);
}
/* Search */
for(i = 0; i < 12; i++)
{
status
=
ca_create_channel
(pv[i],connectionChangedCB,NULL,CA_PRIORITY_DEFAULT,&pCh[i]);
if(status != ECA_NORMAL)
{
printf("ca_create_channel for pv%d failed:\n%s\n", i,
ca_message(status));
exit(1);
}
}
/* Wait */
startTime=curTime;
ca_pend_event(timeout);
/* Clear the channel */
for(i = 0; i < 12; i++)
{
status=ca_clear_channel(pCh[i]);
if(status != ECA_NORMAL)
{
printf("ca_clear_channel for pv%d failed:\n%s\n", i,
ca_message(status));
}
}
/* Exit */
ca_context_destroy();
...
...
...
}
I thought I had included everything I need, but apparently I missed
something.
Any help would be greatly appreciated,
Bertrand
Happy post July 4th!