Hello, I am working on java project with OpenGL OpenCL interoperability. I use JOGL for java OpenGL binding. Problem occur, when I use jogl in Linux (in windows it work fine). 6 unclosed connections remain after each java (jogl) program completion and I have error "maximum number of clients reached" after 20-30 launches (max connections 255).
OS: Kubuntu 13.04 (Kubuntu 12 has same problem);
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 13.04
Release: 13.04
Codename: raring
driver: amd-driver-installer-catalyst-13-4-x86.x86_64
OpenCL SDK: AMD-APP-SDK-v2.8-lnx64
fglrxinfo
display: : 0 screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 6800 Series
OpenGL version string: 4.2.12217 Compatibility Profile Context 12.104.
To detect errors, you can run any standard test of JOGL (same with other java tool LWJGL). You can also run a Java test:
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
public class Test{
static void main(String[] args){
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault);
}
}
I use next console command for determine current x-server connection count: sudo ls /proc/1233/fd |wc -l where 1233 is process id of Xorg. After this count overflow 255 occur "maximum number of clients reached" and call XOpenDisplay return 0.
After reviewing native JOGL code, I found out that six x-server connections added when first GLX call occur. These six connections are not caused by any java and JNI code instructions and this connections remain after java completion. The approximate order of the jogl native instructions:
1) Create Display by XOpenDisplay(":0");
2) Determine XServer vendor by glXQueryServerString((Display *) (intptr_t) dpy, (int) screen, (int) name); Six additional connections are formed immediately after this step. If determine vendor by ServerVendor((Display *) (intptr_t) dpy); then connections not formed, bat error occur on next call of glX.
Sorry for bad English.