-
Notifications
You must be signed in to change notification settings - Fork 119
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
Dangling references prevent GC to collect instances #255
Comments
I think one of the problem is that the "observation" contains a reference to the observation_space (in the environment) that has a backend. |
Hello, As I cannot reproduce it, it is likely that this bug will be in next release of grid2op. |
You mean you cannot reproduce the bug with an RLlib wrapper? If it helps, I can put together a simple repro example. It's also possible that I'm doing something wrong, so let's see. |
Can you put some simple code here ? If possible without using RLLIB :-/ The smallest / simplest piece of code, the easiest it will be for me to identifiy the bug and then fix it :-) |
Closing at it seems solved |
Environment
1.6.3
ubuntu18.04
Bug description
Then the env instance is deleted (e.g. by
del
) then GC should collect it.It does happen in most scenarios, but in some cases there are references to the env instance that doesn't allow for the collection of obsolete instances.
How to reproduce
Running the following shows that GC does it's job:
However, if there's a wrapper around the env (as it's required for RLlib) there are calls to
env.step
and the wrapper (or other parts of the framework) might store a reference to the env through the returned observation, reward or info.In my case using
deepcopy
(see below) resolves the issue:Otherwise, there are a pile of dangling instances that doesn't get collected.
Currently I'm using the following (that's called in the
reset
method of my wrapper when it's needed e.g. for curriculum learning):The commented out bit prints the number of grid2op env instances in the given process.
The text was updated successfully, but these errors were encountered: