Farama-Foundation / ViZDoom

Reinforcement Learning environments based on the 1993 game Doom :godmode:
https://vizdoom.farama.org/
1.71k stars 396 forks source link

Random segfault on exit (python3) #123

Closed wjaskowski closed 7 years ago

wjaskowski commented 7 years ago

Sometimes (20% of cases), ViZDoom segfauls (segmentation fault (core dumped)) on exit. This happens after the close() command. Master, python3, ubuntu 16.04. To reproduce execute the following script 10 times:

from __future__ import print_function
import sys
from time import sleep
from vizdoom import *

game = DoomGame()
scenario_config = "../config/basic.cfg"
game.load_config(scenario_config)
game.set_mode(Mode.PLAYER)

game.init()

episodes = 1
print("")
for i in range(episodes):
    print("Episode #" + str(i + 1))

    game.new_episode()
    while not game.is_episode_finished():
        s = game.get_state()
        img = s.screen_buffer
        misc = s.game_variables

        game.advance_action()
        a = game.get_last_action()
        r = game.get_last_reward()

    print("total reward:", game.get_total_reward())
    print("************************")

game.close()
mihahauke commented 7 years ago

It seems that this doesn't affect python2. It seems that something is wrong with python3 binding.

mihahauke commented 7 years ago

Sounds familiar: https://bitbucket.org/glotzer/hoomd-blue/issues/88/segfault-at-exit-with-python34

biggzlar commented 6 years ago

Hi there, I'm encountering segmentation faults on macOS 10.13.4 using either Python2.7 or Python3.6.

This only occurs when I call game.close(), everything else works flawlessly. Some details about my system (this is on a Python2.7 virtualenv):

macOS==10.13.4
dlib==19.15.0
face-recognition==1.2.2
face-recognition-models==0.3.0
vizdoom==1.1.6