Experimental Physics and Industrial Control System
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!
- Replies:
- Re: unable to create virtual circuit b/c "Too many open files" Bertrand H.J. Biritz
- References:
- CAC: unable to create virtual circuit b/c "Too many open files" Bertrand H.J. Biritz
- Navigate by Date:
- Prev:
CAC: unable to create virtual circuit b/c "Too many open files" Bertrand H.J. Biritz
- Next:
Re: unable to create virtual circuit b/c "Too many open files" Bertrand H.J. Biritz
- 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
2025
- Navigate by Thread:
- Prev:
CAC: unable to create virtual circuit b/c "Too many open files" Bertrand H.J. Biritz
- Next:
Re: unable to create virtual circuit b/c "Too many open files" Bertrand H.J. Biritz
- 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
2025