SofaDefrost / SofaGym

Machine Learning framework for Sofa
72 stars 10 forks source link

Rendering issue #18

Closed samuelmyoussef closed 1 year ago

samuelmyoussef commented 1 year ago

There's an issue in the environments' gui when the render argument is activated, the simulation window crashes with this error:

/home/samuelyoussef/.local/lib/python3.10/site-packages/glfw/__init__.py:916: GLFWError: (65544) b'EGL: Failed to make context current: EGL cannot access a requested resource'
  warnings.warn(message, GLFWError)

########## SIG 11 - SIGSEGV: segfault ##########
  sofa::helper::BackTrace::sig(int)
  glfwCreateWindow
  _PyObject_MakeTpCall
  _PyEval_EvalFrameDefault
  _PyFunction_Vectorcall
  _PyEval_EvalFrameDefault
  _PyFunction_Vectorcall
  _PyObject_FastCallDictTstate
  _PyObject_MakeTpCall
  _PyEval_EvalFrameDefault
  _PyEval_EvalFrameDefault
  _PyEval_EvalFrameDefault
  PyEval_EvalCode
  _PyRun_SimpleFileObject
  _PyRun_AnyFileObject
  Py_RunMain
  Py_BytesMain
  __libc_start_main
  _start
Segmentation fault (core dumped)
[ERROR]   [SofaRuntime] ConnectionRefusedError: [Errno 111] Connection refused
Traceback (most recent call last):
  File "/home/samuelyoussef/Documents/SOFA/Plugins/SofaGym/sofagym/rpc_client.py", line 181, in <module>
    task = s.getNextTask(stateId)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1464, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1178, in single_request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1291, in send_request
    self.send_content(connection, request_body)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1321, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3.10/http/client.py", line 941, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.10/socket.py", line 845, in create_connection
    raise err
  File "/usr/lib/python3.10/socket.py", line 833, in create_connection
    sock.connect(sa)

I temporarily fixed the issue by moving the glfw create window function before the pygame initialization

https://github.com/SofaDefrost/SofaGym/blob/5f4a01720299dfe642ab573d929948be8e2a772e/sofagym/viewer.py#L101-L105

now the rendering is working but the simulation window keeps showing a not responding message while running.