GLib-ERROR when using pre-compiled App instead of Xcode

I’m using ofxGstreamer to pull in 14 different RTSP feeds. My app runs perfectly as long as I compile/run it from Xcode, but when I try to run the standalone app it crashes when connecting to the 13th camera.

Even more weird, the precompiled standalone app will run fine when using videos instead of gstreamer feeds or when I use only 12 cameras in total.

The error I get is:

 GLib-ERROR **: Creating Pipes for GWakeup: Too many open files 

Initial digging shows it’s a problem with resources not being cleaned up properly (i.e. sockets/file descriptors not being closed/deleted).

Any idea of what the problem is and why it would run in Xcode but not straight from the App file?

Found the issue. Turns out newer OSX versions (I’m on 10.11.3 El Capitan) limit how many files are allowed to be open to only 256. With all the different feeds and each gstreamer element opening and closing their own files the cap was about 12 cameras before the error popped up. And apparently, Xcode lifts this OSX restriction when run from within the IDE, which is mighty nice of it to do but not helpful in finding the issue. Good to know about these Xcode behaviors for other people having similar issues with apps not running outside of the IDE.

If you run into this issue, you can increase the maximum number of open files for your system using launchd/launchctl. Below is a link on how to do it, make sure you visit the comments for making sure the system changes take effect.

Change max files in El Capitan:

1 Like