Skip to content

Python GIL issue when simulation is exiting #75

Description

@christophe0606

It is a minor issue because the demo FVP_Audio worked and the output audio file was generated.
I have set AUDIO_STREAM_DURATION to 1 so the simulation is stopping after one second of output is generated.

And it looks like exiting the simulation is causing some troubles (Python 3.12 used):

Audio streaming started...
Audio streaming stopped.
Info: /OSCI/SystemC: Simulation stopped by user.
Fatal Python error: _Py_GetConfig: the function must be called with the GIL held, 
after Python initialization and before Python finalization, but the GIL is released (
the current Python thread state is NULL)
Python runtime state: initialized

Here are the error details (on Windows but I edited the path before copying in this issue):

Thread 0x000053cc (most recent call first):
  <no Python frame>
Traceback (most recent call last):
Traceback (most recent call last):
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 774, in <module>
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_audio_server.py", line 682, in <module>
Traceback (most recent call last):
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 774, in <module>
Traceback (most recent call last):
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_audio_server.py", line 682, in <module>
Traceback (most recent call last):
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 774, in <module>
    Server.run()
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 672, in run
Traceback (most recent call last):
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 774, in <module>
    Server.run()
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_audio_server.py", line 584, in run
    Server.run()
    Server.run()
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 672, in run
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_audio_server.py", line 584, in run
    recv = conn.recv()
           ^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 250, in recv
    Server.run()
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 672, in run
    buf = self._recv_bytes()
    Server.run()
    recv = conn.recv()
          ^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^
  File "$HOME/AVH/board/Corstone-300/vsi/python/vsi_video_server.py", line 672, in run
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 250, in recv
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 430, in _recv_bytes
    recv = conn.recv()
           ^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 250, in recv
    recv = conn.recv()
           ^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
          ^^^^^^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 430, in _recv_bytes
    recv = conn.recv()
           ^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 250, in recv
    buf = self._recv(4)
    buf = self._recv_bytes()
          ^^^^^^^^^^^^^
          ^^^^^^^^^^^^^^^^^^
    buf = self._recv_bytes()
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 430, in _recv_bytes
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 395, in _recv
    recv = conn.recv()
    buf = self._recv(4)
           ^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 250, in recv
          ^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 395, in _recv
          ^^^^^^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 430, in _recv_bytes
    buf = self._recv_bytes()
          ^^^^^^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 430, in _recv_bytes
    buf = self._recv(4)
          ^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 395, in _recv
    chunk = read(handle, remaining)
    buf = self._recv(4)
            ^^^^^^^^^^^^^^^^^^^^^^^
          ^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 395, in _recv
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
    chunk = read(handle, remaining)
    buf = self._recv_bytes()
            ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
          ^^^^^^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 430, in _recv_bytes
    chunk = read(handle, remaining)
            ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
    buf = self._recv(4)
    chunk = read(handle, remaining)
          ^^^^^^^^^^^^^
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 395, in _recv
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
    buf = self._recv(4)
          ^^^^^^^^^^^^^
  File "$HOME/AppData/Local/Programs/Python/Python312/Lib/multiprocessing/connection.py", line 395, in _recv
    chunk = read(handle, remaining)
            ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
    chunk = read(handle, remaining)
            ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions