Segmentation fault with glXMakeCurrent

I am working on a multi-display project, one computer with one monitor and 4 projectors. The monitor is driven by a Geforce 8400 graphics on display ‘:0.0’. Four projectors are driven by two Geforce 8800GT (Two DVI ports on each card) on displays ‘:1.0’, ‘:1.1’, ‘:2.0’, ‘:2.1’. My program renders one window per display. It works fine for me to draw on ‘:0.0’, ‘:1.0’ and ‘:1.1’. However, when I try to call glXMakeCurrent() to draw on display ‘:2.0’, the program crashes with a segmentation fault. As I was debugging, I found an interesting thing with the window ID and root window ID for each display:
display:’:0.0’,screen: 0, root window id: 315, window id: 71303171
display:’:1.0’,screen: 0, root window id: 595, window id: 2097156
display:’:1.1’,screen: 1, root window id: 597, window id: 4194308
display:’:2.0’,screen: 0, root window id: 595, window id: 2097156
display:’:2.1’,screen: 1, root window id: 597, window id: 4194308

It seems that X Server 1 and 2 assign window ID with the same strategy, which is different from X Server 0. I am wondering whether it is causing the crashing or it is a problem with the X Server settings.

Could someone give some suggestions on how to debug this problem? Thanks in advance!

I tried generating two windows and draw on the second window in
displays ‘:2.0’ and ‘:2.1’. This makes the window id used for rendering different from the windows in displays ‘:1.0’ and ‘:1.1’. And it works! The function glXMakeCurrent() does not
crash, and the rendering also seems to be correct.

Could it be possible that it is a bug in GLX or the graphics driver?