openai / roboschool

DEPRECATED: Open-source software for robot simulation, integrated with OpenAI Gym.
Other
2.12k stars 486 forks source link

solved segfault issue when multiple rendering (#141) #171

Open francesco-mannella opened 5 years ago

francesco-mannella commented 5 years ago

Modified roboschool/cpp-household/python-binding.py so that OpenGL is correctly initialized in the two cases (app instance was already allocated or not)

francesco-mannella commented 5 years ago

The else clause is useless. The needed change is uncommenting line 159

olegklimov commented 5 years ago

Can you please provide a small script to reproduce the crash? Like create and destroy environment so this else branch is triggered, crash can be observed before this change, no crash after.

francesco-mannella commented 5 years ago

Can you please provide a small script to reproduce the crash? Like create and destroy environment so this else branch is triggered, crash can be observed before this change, no crash after.

The issue was the same as #141. The following code crashed before the proposed change:

import gym, roboschool
from OpenGL import GLU
import time

env = [None, None]
for i in range(2):
    env[i] = gym.make('RoboschoolReacher-v1')
    env[i].reset()

while True:
    for i in range(2):
        action = env[i].action_space.sample()
        observation, reward, done, info = env[i].step(action)
        print("Render")
        env[i].render()
    time.sleep(1)
pzhokhov commented 5 years ago

@francesco-mannella so the only change was to uncomment the line on line 159? Could you also add a python unit test (for instance, the one that would run the snippet that you provided)? Thanks!