Stable-baselines: DummyVecEnv render window not closing with env.close()

Created on 12 Feb 2019  路  4Comments  路  Source: hill-a/stable-baselines

Hi, thank you for maintaining this repo, it's great! I'm experiencing a small problem with the visual render. When I use env.close() on a DummyVecEnv object to free up the environment resources, the render window is not closed.
If I do the same with the Gym env object the render window closes.

env.envs[0].close() does work.

stable-baselines==2.4.0
tensorboard==1.12.2
tensorflow==1.12.0

No GPU, Ubuntu 18.04 lts.

bug

Most helpful comment

I reopen it until #206 is merged ;) (so it is clear when the issue is really fixed)

All 4 comments

Hello,
Looks like a bug, thanks for reporting it.
Looking at the code, it seems that close() method does not do anything...
https://github.com/hill-a/stable-baselines/blob/master/stable_baselines/common/vec_env/dummy_vec_env.py#L61

Hello, its easy to fix this bug
You can modify the close() which in dummy_vec_env.py
def close(self): self.envs[0].close()
I believe it works. @araffin @ClonedOne

Sorry got distracted doing other stuff. Yes as @sxwgit said it is really easy to fix, either
for env in self.envs: env.close()
or
self.envs[0].close() will work.

Btw I've run the test with for env in self.envs: env.close() and it doesn't seem to break anything

I reopen it until #206 is merged ;) (so it is clear when the issue is really fixed)

Was this page helpful?
0 / 5 - 0 ratings