Search code examples
x11xlib

Understanding Xlib Failed Requests


Without going into too much detail (I am looking for debugging techniques here), I would like to understand how to better debug Xlib failed requests. In particular dealing with the glx extension. The occurrence of the bug I am fighting is in a complex place within my application and trying to pull it apart to provide a small sample here is not possible.

With that said the failed request I am seeing is

x10:  fatal 10 error 11 (Resource temporarily unavailable) on X server ":0.0"
      after 46 requests (46 know processed) with 0 event remaining.
X Error of failed request: BadAccess (attempt to access private resource denied)
  Major opcode of failed request: 135 (GLX)
  Minor opcode of failed request: 5 (XGLMakeCurrent)
  Serial number of failed request: 46
  Current serial number in output stream: 46

I can see where the problem is being caused by stepping through with the debugger. However, I can't fully discern why it is happening.


Solution

  • The clue where to look is in the name of the extension and the name of the request itself. Unfortunately in this case because of your use of Xgl this isn't so helpful. But you can check what the request really is by checking out the protocol documentation like this one for glproto. From that you can see that the request is really glxMakeCurrent. Then you just need to find the documentation or code for that request.

    The GLX specification says glxMakeCurrent will give BadAccess if "the context is current to some other thread".

    Now, your error is about XGLMakeCurrent which is an implementation detail of Xgl . But from reading the implementation of this function it passes through to the the underlying GLX implementation.

    To fix your problem I suggest you try and identify if that context is being used in another thread.