paraview.simple Render() from different threads crashes

Hello,
I am trying to render from different threads (Ubuntu 22.04 and python 3.10.12). Apparently, X11 has problems with concurrent rendering. The example below crashes at the call to Render() inside threadFun with the output:

X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  74
  Current serial number in output stream:  74

My example code:

from paraview.simple import *

sphere1 = Sphere()
Show(sphere1)
Render()

def threadFun():    
    sphere2 = Sphere()
    Show(sphere2)
    Render() # This line causes the X Error

import threading
t=threading.Thread(target=threadFun)
t.start()
t.join()

Is it possible to fix the example, so that different threads can use the Render() call? If it makes things easier, each thread could render to its own RenderWindow.

BR
Torben

Hi @Torben

Rendering from multiple threads like that is not explicitly supported. You could try to render into separate views, but I doubt even that would work.