gym-http-api icon indicating copy to clipboard operation
gym-http-api copied to clipboard

I meet a error

Open Charele opened this issue 6 years ago • 1 comments

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)

Charele avatar Aug 25 '18 12:08 Charele

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.

parthopdas avatar Oct 08 '20 15:10 parthopdas