Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I meet a error #70

Open
Charele opened this issue Aug 25, 2018 · 1 comment
Open

I meet a error #70

Charele opened this issue Aug 25, 2018 · 1 comment

Comments

@Charele
Copy link

Charele commented Aug 25, 2018

I start the gym_http_server,
when I run example_agent.py,I get the error message on server console

Server starting at: http://127.0.0.1:5000

  • Serving Flask app "gym_http_server" (lazy loading)
  • Environment: production
    WARNING: Do not use the development server in a production environment.
    Use a production WSGI server instead.
  • Debug mode: off
    �[33mWARN: gym.spaces.Box autodetected dtype as <type 'numpy.float32'>. Please provide explicit dtype.�[0m
    [2018-08-25 19:59:14,161] ERROR in app: Exception on /v1/envs/f8c9a1cd/step/ [POST]
    Traceback (most recent call last):
    File "C:\Anaconda2\lib\site-packages\flask\app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
    File "C:\Anaconda2\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "C:\Anaconda2\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File "C:\Anaconda2\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
    File "C:\Anaconda2\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.view_functionsrule.endpoint
    File "gym_http_server.py", line 258, in env_step
    [obs_jsonable, reward, done, info] = envs.step(instance_id, action, render)
    File "gym_http_server.py", line 71, in step
    env.render()
    File "C:\Anaconda2\lib\site-packages\gym\core.py", line 284, in render
    return self.env.render(mode)
    File "C:\Anaconda2\lib\site-packages\gym\core.py", line 284, in render
    return self.env.render(mode)
    File "C:\Anaconda2\lib\site-packages\gym\envs\classic_control\cartpole.py", line 137, in render
    return self.viewer.render(return_rgb_array = mode=='rgb_array')
    File "C:\Anaconda2\lib\site-packages\gym\envs\classic_control\rendering.py", line 82, in render
    glClearColor(1,1,1,1)
    File "C:\Anaconda2\lib\site-packages\pyglet\gl\lib.py", line 105, in errcheck
    raise GLException(msg)
@parthopdas
Copy link

parthopdas commented Oct 8, 2020

This issues appears to be on windows only.

It seems to due to pyglet attempting to access opengl state across multiple threads: first thread creating the viewer (initializing opengl through pyglet) and a different thread (from the next step) calling render which then calls opengl again.

can you try the following and see if it works for you - considering use case, i think is a good enough fix.
image

the above fix works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants