title: XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" after 235 requests (235 known processed) with 0 events remaining
body: <p>Yes other people have asked this question before, but not in the same context or to my satisfaction. So, here goes::</p>
  
  <p>I am writing an application using python, the program using pygame (ergo opengl) to display the graphics. The graphics are generated in the program itself (so no directory issues whatsoever). </p>
  
  <p>The application also needs to access the input parallely from a user. To achieve this I use a multiprocessing block with a pipe and read the input key using pygame event loop. The below code runs in a loop. The first loop iteration works fine, but on the 2nd iteration I am thrown that XIO error.</p>
  
  <pre><code>   parent, child = Pipe(duplex=True)
     # this function draws the canvas
     switches, retOrient = self.drawCanvas(cond, count, dispSize, moves)
     # this function gets the user input in another thread - stage 1
     p = Process(target=userInput, args=(self.button, child) )
     p.start()
     b_press = parent.recv()
     parent.close()
  
  def userInput(button, child):
      button_pressed = button.blockAndWait()
      child.send( "%s"%(button_pressed.keyname) )
      child.close()
  </code></pre>
  
  <p>I am a little perplexed at how this error occurs, what are the internals in XIO that cause it. None of the other answers actually explain the root cause of this error. Considering it works fine as a single process application, the multiprocessing module is closing some IO channel (the input registered object, the display object or the event loop) or opening some unnecessary channels. How can I decipher what exactly is causing this XIO error?  </p>