Farama-Foundation / Arcade-Learning-Environment

The Arcade Learning Environment (ALE) -- a platform for AI research.
GNU General Public License v2.0
2.1k stars 416 forks source link

Closing environment causes a crash #499

Open Jonii opened 9 months ago

Jonii commented 9 months ago
import gymnasium as gym

game_name = 'ALE/MontezumaRevenge-v5'
env = gym.make(game_name, render_mode="human")
obs, _ = env.reset()
env.close()

import time

print("sleeping")
time.sleep(5)

What's expected is that the game would open and close, you'd see text "sleeping", and after 5s, the program exits. What actually happens is that the game window stays up for 5s, after which the program exits. The actual game renders properly until you try to close it, this example does not demonstrate that part since it is working as expected.

This bug is made worse in Jupyter, where this causes the Python kernel to crash if you try to render the game.

Using version 0.8.1 on Ubuntu 22.04.