Issue copying GymEnv wrapping AtariPreprocessing
jamesborg46 opened this issue · comments
James Borg commented
The following code results in double free or corruption (!prev)
error using:
atari-py 0.2.9
garage 2021.3.0
gym 0.15.7
from garage.envs import GymEnv
import gym
import gym.wrappers
import gym.envs.atari
import copy
env = gym.envs.atari.AtariEnv('breakout')
env.spec = gym.envs.registration.EnvSpec('NoFrameskip-v0')
env = gym.wrappers.AtariPreprocessing(env)
env = GymEnv(env, max_episode_length=1000)
copy.deepcopy(env)
copy.deepcopy(env)
The issue only occurs on the second deepcopy.
garage/src/garage/envs/gym_env.py
Line 349 in 2c5410e
Editing the above line to
if 'viewer' in env.__dict__ and env.__dict__['viewer'] is not None:
fixed this for me, but I did not look deeply into the issue so this might not be the most appropriate fix.