Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProcConcatVec close fix #219

Merged

Conversation

elliottower
Copy link
Contributor

This updates the code from #208 to work with the current master branch. I independently found that the ProcConcatVec env didn't close and couldn't figure out the solution myself, but found this PR from a few months ago seems to address it. Running CI to see if it works now.

callumcurtis and others added 3 commits March 21, 2023 23:54
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. __del__ in ProcConcatVec has been removed as
its parent class VectorEnv already delegates to close in its __del__.
The terminate instruction has been removed from the subprocess event
loop as it is now redundant.
@elliottower elliottower merged commit 9b26d8c into Farama-Foundation:master Jul 7, 2023
@elliottower elliottower deleted the procconcatvec-close-fix branch July 7, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants