mujoco icon indicating copy to clipboard operation
mujoco copied to clipboard

Loading xml into mujoco viewer leads to crash with the following ERROR: Auxiliary buffer size exceeds maximum allowed by OpenGL implementation

Open brudermueller opened this issue 1 year ago • 20 comments

Hi,

I'm a PhD student and I'm trying to use MuJoCo for contact-rich robot manipulation I have just upgraded my Mujoco version to the newest version, as I want to use newer features, e.g. in the passive launch of the viewer and in modifying the scene.
With mujoco_210, the viewer was working perfectly. Now, each time I run python3 -m mujoco.viewer, the viewer launches, but the moment I drag an xml file into the viewer (for any xml-file, even very basic ones), such as the one pasted below, I get the following error in my terminal:

ERROR: Auxiliary buffer size exceeds maximum allowed by OpenGL implementation

Press Enter to exit ...

I was trying to find out any driver requirements for the mujoco versions, but couldn't find any information. I would appreciate any kind of leads on how to solve that problem. Many thanks in advance!

  • Mujoco version: mujoco 3.0.1
  • Python version: Python 3.10.13
  • NVIDIA-SMI 535.129.03 (driver version)
  • Cuda version: 11.7
<mujoco model="mug">
<visual>
<headlight ambient="0 0 0" diffuse="0 0 0" specular="1 1 1"/>
<quality shadowsize="8192"/>
</visual>
<asset>
<texture name="mug" file="mug.png" type="2d"/>
<material name="mug" texture="mug" specular="1" shininess="1"/>
<mesh file="mug.obj" scale=".01 .01 .01"/>
<material name="floor" reflectance=".1"/>
</asset>
<default>
<default class="collision_mug">
<geom type="box" group="3"/>
<default class="cup">
<geom size="0.0026 0.00704 0.033"/>
</default>
<default class="handle">
<geom size="0.0025 0.00328 0.0055"/>
</default>
</default>
</default>
<worldbody>
<light pos=".4 -.4 .3" dir="-2 2 -1.5" diffuse=".6 .6 .6"/>
<light pos="-.2 -.4 .3" dir="1 2 -1.5" diffuse=".6 .6 .6"/>
<geom type="plane" size="5 5 .01" rgba="1 1 1 1" material="floor"/>
<body name="mug">
<freejoint/>
<geom type="mesh" mesh="mug" material="mug" euler="90 0 0" group="1" contype="0" conaffinity="0"/>
<geom class="cup" pos="0.0418 0 0.038" euler="0 0 0"/>
<geom class="cup" pos="0.0398 0.0129 0.038" euler="0 0 18"/>
<geom class="cup" pos="0.0339 0.0246 0.038" euler="0 0 36"/>
<geom class="cup" pos="0.0246 0.0339 0.038" euler="0 0 54"/>
<geom class="cup" pos="0.0129 0.0398 0.038" euler="0 0 72"/>
<geom class="cup" pos="0 0.0418 0.038" euler="0 0 90"/>
<geom class="cup" pos="-0.0129 0.0398 0.038" euler="0 0 108"/>
<geom class="cup" pos="-0.0246 0.0339 0.038" euler="0 0 126"/>
<geom class="cup" pos="-0.0339 0.0246 0.038" euler="0 0 144"/>
<geom class="cup" pos="-0.0398 0.0129 0.038" euler="0 0 162"/>
<geom class="cup" pos="-0.0418 0 0.038" euler="0 0 180"/>
<geom class="cup" pos="-0.0398 -0.0129 0.038" euler="0 0 198"/>
<geom class="cup" pos="-0.0339 -0.0246 0.038" euler="0 0 216"/>
<geom class="cup" pos="-0.0246 -0.0339 0.038" euler="0 0 234"/>
<geom class="cup" pos="-0.0129 -0.0398 0.038" euler="0 0 252"/>
<geom class="cup" pos="0 -0.0418 0.038" euler="0 0 270"/>
<geom class="cup" pos="0.0129 -0.0398 0.038" euler="0 0 288"/>
<geom class="cup" pos="0.0246 -0.0339 0.038" euler="0 0 306"/>
<geom class="cup" pos="0.0339 -0.0246 0.038" euler="0 0 324"/>
<geom class="cup" pos="0.0398 -0.0129 0.038" euler="0 0 342"/>
<geom class="cup" type="cylinder" size="0.045 0.0026" pos="0 0 0.0026"/>
<body name="handle" pos="0.056 0 0.0395" euler="90 0 0">
<geom class="handle" pos="0.0193 0 0" euler="0 0 0"/>
<geom class="handle" pos="0.0184 0.00568 0" euler="0 0 17.1"/>
<geom class="handle" pos="0.0159 0.0108 0" euler="0 0 34.3"/>
<geom class="handle" pos="0.012 0.0151 0" euler="0 0 51.4"/>
<geom class="handle" pos="0.00703 0.0179 0" euler="0 0 68.6"/>
<geom class="handle" pos="0.00144 0.0192 0" euler="0 0 85.7"/>
<geom class="handle" pos="0.00144 -0.0192 0" euler="0 0 274"/>
<geom class="handle" pos="0.00703 -0.0179 0" euler="0 0 291"/>
<geom class="handle" pos="0.012 -0.0151 0" euler="0 0 309"/>
<geom class="handle" pos="0.0159 -0.0108 0" euler="0 0 326"/>
<geom class="handle" pos="0.0184 -0.00568 0" euler="0 0 343"/>
<geom class="collision_mug" size="0.007 0.0025 0.0055" pos="-0.007 -0.0195 0"/>
<geom class="collision_mug" size="0.007 0.0025 0.0055" pos="-0.007 0.0195 0"/>
</body>
</body>
</worldbody>
</mujoco>


brudermueller avatar Dec 12 '23 11:12 brudermueller

Additional note: this is only the case for the newest mujoco release. That error does not occur under Mujoco 3.0.0.

brudermueller avatar Dec 12 '23 12:12 brudermueller

What operating system are you on?

nimrod-gileadi avatar Dec 12 '23 14:12 nimrod-gileadi

Ubuntu 20.04

brudermueller avatar Dec 12 '23 15:12 brudermueller

I don't have a solution for you, and I was unable to reproduce this bug. However, we just pushed version 3.1.0 of the mujoco package. Could you upgrade and try again? We should have a better error message to debug the issue.

nimrod-gileadi avatar Dec 13 '23 22:12 nimrod-gileadi

I guess it's some weird versioning issue.... The issue persists under 3.1.0, while everything is working fine under 3.0.0. The error message is now the following: ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 16566 > 16384

brudermueller avatar Dec 14 '23 08:12 brudermueller

Not clear how to help you without being able to reproduce.

It looks like your system is trying to open a huge window for some reason. Does reducing offsamples help?

Closing due to inability to reproduce.

yuvaltassa avatar Jan 02 '24 15:01 yuvaltassa

I just faced the same issue Auxiliary buffer size exceeds maximum allowed by OpenGL implementation I have a model where everything works in mujoco-3.0.0 and fails with the above error after mujoco>=3.0.1

The bug seems to be related to the number of rendered objects present in the scene. As I comment out parts of the scene to make it lighter the size mentioned in the error starts decreasing. After a point the model starts working

ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 18470 > 16384
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 18470 > 16384
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 17860 > 16384
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 16701 > 16384
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 16701 > 16384
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 16457 > 16384
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 16396 > 16384
# works once < 16384

The size that is changing above seems to be

  • influenced by adding/removing joints and actuators
  • not influenced by adding/removing geoms, sites, tendons

In comparison to the issues encountered by @brudermueller

  • the max size (16384) seems to be the same for me and @brudermueller
  • the model provided by him, works well on my system. So I wan't able to reproduce his bug as well. This is consistent with @nimrod-gileadi @yuvaltassa observation above.

Here are the dimensions of the model I am working with

nq                    100
nv                    100
nu                    170
na                    170
nbody                 99
nbvh                  668167
nbvhstatic            668167
njnt                  100
ngeom                 111
nsite                 1181
ncam                  7
nlight                2
nmesh                 112
nmeshvert             172004
nmeshnormal           172004
nmeshtexcoord         16783
nmeshface             334073
nmeshgraph            513264
ntex                  2
ntexdata              6145728
nmat                  2
ntendon               296
nwrap                 919
nuser_jnt             1
nnames                33958
npaths                3485
nnames_map            4164
nM                    2342
nD                    4584
nB                    4094
njmax                 1000
nconmax               400
ntree                 1
narena                63963136
nbuffer               67721501

Im on M3-Mac

vikashplus avatar Jan 06 '24 03:01 vikashplus

I can confirm the issue @vikashplus encounters with Mujoco version>=3.0.1:

ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 21642 > 16384

I am running the code on Intel MBP 16 GB RAM what would explain the buffer height limit of 16384. Did Mujoco's memory footprint change with version 3.0.1?

Jendker avatar Jan 17 '24 00:01 Jendker

@yuvaltassa @nimrod-gileadi -- There is more evidence coming in on this issue. Will it be okay to re-open this issue?

vikashplus avatar Jan 20 '24 17:01 vikashplus

I tried to get a bit more evidence, too. @vikashplus: for me, adding/removing actuators does not help and no matter what model I load, I always get the same buffer height. Moreover, I tried adjusting the visual/quality properties in my xml-file (incl. offsamples as proposed by @yuvaltassa) to smaller values but none of this had any effect on the error. Maybe it would help to compare OpenGL versions?

glxinfo | grep "version"
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 4.60
OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.2.6
OpenGL shading language version string: 4.60
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
    GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,
glxinfo | grep "OpenGL version"
OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.2.6

brudermueller avatar Jan 22 '24 12:01 brudermueller

Thanks @brudermueller!

@saran-t will be back in February and hopefully be able to diagnose/fix this.

yuvaltassa avatar Jan 22 '24 14:01 yuvaltassa

I'm able to consistently reproduce the bug with Mesa softpipe (to exclude the differences between opengl implementations).

combinatorylogic avatar Jan 27 '24 10:01 combinatorylogic

The largest chunks contributing to the aux buffer height: Physics (4314), Visualisation (4212), Rendering (2646) and Group Enable (2646). Adding up to 16632.

combinatorylogic avatar Jan 27 '24 10:01 combinatorylogic

Something happened between 3.0.0 and 3.0.1 that caused the calculated max height for the left UI pane to increase. Given that none of our team is able to reproduce the issue locally, it'll be really helpful if someone who's affected can help us bisect to see which commit between 3.0.0 and 3.0.1 this issue first appeared.

Separately, the way that we're currently drawing the UI panes are a bit silly. We make a draw buffer that's as tall as the UI pane can possibly be if it's fully expanded, then draw everything, then clip to viewport. This is inefficient both in compute and memory usage. A better approach would be to do a check on each UI element and just don't draw if it's completely outside the bounds.

saran-t avatar Feb 02 '24 15:02 saran-t

We've figured this out. It has to do with an unfortunate design choice of the UI framework (described above by @saran-t) combined with the limitations of some GL backends, combined with high-resolution screens. We might figure out a better way to solve this but in the meantime we'll just reduce the maximum default font size by one click.

@vikashplus, if you avoid opening both the Joint and Actuator tabs in the rightUI you should avoid a crash.

Please try building from source and let us know if this "fix" works for you.

yuvaltassa avatar Feb 02 '24 23:02 yuvaltassa

I gave it a quick spin. I was also able to make it reproducible on a public model

./simulate https://github.com/MyoHub/myo_sim/blob/main/leg/myolegs.xml

What I observe for this model

  • loads fine under the default setting
  • It crashes with following error when I boost the font to 300%
MuJoCo version 3.1.2
ERROR: Auxiliary buffer height exceeds maximum allowed by OpenGL implementation: 16656 > 16384

vikashplus avatar Feb 03 '24 01:02 vikashplus

Ya this is why the commit said "workaround" rather than "fixed"... 😜

Please avoid 300% for now.

yuvaltassa avatar Feb 03 '24 07:02 yuvaltassa

@yuvaltassa -- I have a large model that crashes on load (default font to 200%). Any workaround that I can use?

vikashplus avatar Feb 17 '24 20:02 vikashplus

@vikashplus

Do what I did in eb844a4b7725822c609ef6a3403c0f1c5635e693, but reduce to 150 🙂

We'll have a proper fix at some point, but I don't know when that will be.

yuvaltassa avatar Feb 20 '24 12:02 yuvaltassa

Another workaround that doesn't require rebuilding is launching the viewer with python -m mujoco.viewer, reducing the font size to 50% or 100%, and then dragging the model file into the viewer.

Looking forward to a proper fix for this :slightly_smiling_face:

hello-binit avatar Mar 26 '24 14:03 hello-binit

Hi folks, this is now fixed at head. Please build from source and let us know if there is any remaining issue...

yuvaltassa avatar Jun 24 '24 12:06 yuvaltassa