File Descriptors Not Freed

I’m not sure if there is anything that can be done, but I ran across an issue that maybe someone else can help me come up with a way to workaround. I’m working on a system where I need to develop a daemon that monitor’s the system status and transmits it to an LCD display driven by an XEM if one is connected.

My problem is rooted in the fact that API calls such as GetDeviceCount appear to consume file descriptors each time I call them (and never close them). Eventually I bump into the per-process file descriptor limit. Has anyone else run into this problem? Are there any solutions?

I’ve put together a simple program that demonstrates the issue. I’m curious to see if you run into the same issue if this source is compiled and run on a system without a FrontPanel capable device connected to it.

#include "okFrontPanelDLL.h"

int main(int argc, char **argv) {
	if (okFrontPanelDLL_LoadLib(NULL) != true){
		exit(1);
	}
	okCUsbFrontPanel *xem = new okCUsbFrontPanel;
	while (xem->GetDeviceCount() 

All that miscellaneous printing to stdout aside (eventually I’ll need to supress this as well), the interesting bits are at the end. I’ll also attach an strace (with -e trace=desc) output that shows that the file descriptors are indeed not being released

I ran these tests with FrontPanel 3.0.10 (I can’t try 3.0.11 because the FC7 builds are not compatible with my debian etch system)

Any help is appreciated.

Cheers,
Evan


strace_file_desc.zip (29.5 KB)

We’ll take a look at the Linux version and report back.

Indeed this was a bug and has been fixed. It will make an appearance in an update soon. Thanks for pointing it out to us.

For closure, please see that we’ve updated the 3.0.11 release to include a 3.0.11b:

http://forums.opalkelly.com/showthread.php?t=649

This 3.0.11b release includes the Linux fix. If you are not using Linux, you do not need an update.