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

Unexpected error loading library libGL.so.1: dlopen: cannot load any more object with static TLS #396

Closed
gabrieledcjr opened this issue Oct 28, 2016 · 3 comments

Comments

@gabrieledcjr
Copy link

Error happens only when rendering the gym environment when using gym along with tflearn or tensorflow's slim.

[2016-10-28 11:09:09,695] Making new env: Pendulum-v0
[2016-10-28 11:09:10,166] Clearing 3 monitor files from previous run (because force=True was provided)
[2016-10-28 11:09:10,839] Starting new video recorder writing to /home/gabrieledcjr/Projects/DLRobotics/src/ddpg_ros/nodes/results/gym_ddpg/openaigym.video.0.6205.video000000.mp4
Unexpected error loading library libGL.so.1: dlopen: cannot load any more object with static TLS
Traceback (most recent call last):
  File "simulation.py", line 377, in <module>
    main("ehll")
  File "simulation.py", line 370, in main
    train(sess, env, actor, critic)
  File "simulation.py", line 279, in train
    s = env.reset()
  File "/usr/local/lib/python2.7/dist-packages/gym/core.py", line 141, in reset
    self.monitor._after_reset(observation)
  File "/usr/local/lib/python2.7/dist-packages/gym/monitoring/monitor.py", line 282, in _after_reset
    self.video_recorder.capture_frame()
  File "/usr/local/lib/python2.7/dist-packages/gym/monitoring/video_recorder.py", line 105, in capture_frame
    frame = self.env.render(mode=render_mode)
  File "/usr/local/lib/python2.7/dist-packages/gym/core.py", line 192, in render
    return self._render(mode=mode, close=close)
  File "/usr/local/lib/python2.7/dist-packages/gym/envs/classic_control/pendulum.py", line 66, in _render
    from gym.envs.classic_control import rendering
  File "/usr/local/lib/python2.7/dist-packages/gym/envs/classic_control/rendering.py", line 23, in <module>
    from pyglet.gl import *
  File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/__init__.py", line 97, in <module>
    from pyglet.gl.lib import GLException
  File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/lib.py", line 142, in <module>
    from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
  File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/lib_glx.py", line 50, in <module>
    gl_lib = pyglet.lib.load_library('GL')
  File "/usr/local/lib/python2.7/dist-packages/pyglet/lib.py", line 135, in load_library
    lib = ctypes.cdll.LoadLibrary(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen: cannot load any more object with static TLS

@tlbtlbtlb
Copy link
Contributor

Linux has a static limit on the number of shared libraries with TLS (Thread-Local Storage, to support C++'s __thread storage class) that can be loaded into a process. Gym itself doesn't use shared libraries, but OpenGL and Tensorflow both have several libraries. The limit is small, like 14 or 32 depending on OS version (it's the version of glibc that matters).

I haven't seen this on Ubuntu 16.04. You didn't say what version you're using, but upgrading might help, as newer versions of glibc have a higher limit. Or you might be able to eliminate a library or two (use python -v to see what it's loading).

If those don't work, here are some more pointers: https://bugzilla.redhat.com/show_bug.cgi?id=1124987

@gabrieledcjr
Copy link
Author

I am using Ubuntu 14.04. I've read about this issue on glibc and I was trying to upgrade it to 2.20 but I have not seen any tutorial or way of doing it. It seems to me that I should update to 16.04. I will try that this weekend.

@gabrieledcjr
Copy link
Author

Upgrading to Ubuntu 16 fixed this problem. Thanks!

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