Currently, ProcConcatVec's subprocesses are not being terminated when
the environment is closed. Instead, they are only terminated when
ProcConcatVec is garbage collected. This is a problem as the
subprocesses cannot be explicitly terminated, and if the client
accidentally holds on to a reference to ProcConcatVec, the child
processes will never be terminated.
According to the Gymnasium documentation, the close method should
be responsible for releasing all of the environment's resources.
This commit fixes the issue by terminating the subprocesses on close.
The graceful shutdown period controls the number of seconds to wait for
the subprocess environments to terminate before killing them. It is set
to None by default, meaning that close will block until all subprocesses
terminate on their own. The terminate instruction has been removed from
the subprocess event loop as it is now redundant.
Currently, ProcConcatVec's subprocesses are not being terminated when the environment is closed. Instead, they are only terminated when ProcConcatVec is garbage collected. This is a problem as the subprocesses cannot be explicitly terminated, and if the client accidentally holds on to a reference to ProcConcatVec, the child processes will never be terminated.
According to the Gymnasium documentation, the close method should be responsible for releasing all of the environment's resources.
This commit fixes the issue by terminating the subprocesses on close. The graceful shutdown period controls the number of seconds to wait for the subprocess environments to terminate before killing them. It is set to None by default, meaning that close will block until all subprocesses terminate on their own. The terminate instruction has been removed from the subprocess event loop as it is now redundant.