Skip to content

Closing environment causes a crash #499

@Jonii

Description

@Jonii
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions