Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

ROS in docker: rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException) #1438

Closed
Durant35 opened this issue Dec 25, 2020 · 5 comments

Comments

@Durant35
Copy link

Host Machine Version: native Ubuntu 18.04.5 LTS, kernel 5.4.0-54-generic
Docker Version: 19.03.14, build 5eb3275d40
ROS Version: Melodic

xxx@xxx-Ubuntu18_04:~$ rviz
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-xxx'
[ INFO] [1608869893.155459337]: rviz version 1.13.15
[ INFO] [1608869893.155485161]: compiled against Qt version 5.9.5
[ INFO] [1608869893.155491681]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1608869893.162153847]: Forcing OpenGl version 0.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
[ WARN] [1608869893.289645537]: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
...
[ERROR] [1608869893.381435377]: Unable to create the rendering window after 100 tries.
[ INFO] [1608869893.381445878]: Stereo is NOT SUPPORTED
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
xxx@xxx-Ubuntu18_04:~$ 
@Durant35
Copy link
Author

Durant35 commented Dec 25, 2020

Are following statements needed for the Dockerfile?

...
ENV NVIDIA_VISIBLE_DEVICES \
    ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
...

Here is the docker run options:

...
docker run \
  --shm-size 1024m \
  --cap-add=SYS_PTRACE \
  --device=/dev/bus/usb \
  --device=/dev/snd \
  --device=/dev/ttyUSB* \
  --device=/dev/video* \
  --env="DISPLAY=${DISPLAY}" \
  --group-add audio \
  --group-add video \
  --interactive \
  --tty \
  --name=${CONTAINER_NAME} \
  --gpus all \
  --net=host \
  --privileged \
  --security-opt seccomp=unconfined \
  --user sensetime \
  --workdir /home/xxx \
  --volume=$XSOCK:$XSOCK:rw \
  --volume=/etc/timezone:/etc/timezone:ro \
  --env="TZ=$(cat /etc/timezone)" \
  ${MOUNT_WS} \
  ${MOUNT_DATA} \
  --volume /media:/media \
  --volume /tmp/today-logs:/tmp/today-logs \
  --restart=unless-stopped \
  -d ${IMAGE_ID} /bin/bash
...

@klueska
Copy link
Contributor

klueska commented Jan 4, 2021

Without the graphics NVIDIA_DRIVER_CAPABILITIES, none of the graphics specific driver lirbaries will be loaded into the container.

That said, I'm not very familiar with running ROS in docker (with our without GPUs). Do you have this same error without GPUs, or is it only specific to when you try and launch it with GPU support?

@Durant35
Copy link
Author

Durant35 commented Jan 4, 2021

Without the graphics NVIDIA_DRIVER_CAPABILITIES, none of the graphics specific driver lirbaries will be loaded into the container.

That said, I'm not very familiar with running ROS in docker (with our without GPUs). Do you have this same error without GPUs, or is it only specific to when you try and launch it with GPU support?

Currently we add these 2 ENV as docker run options, rviz can be launched normally. Sorry didn’t try rviz without GPU support. I opened this issue just thought it’s a general one and many friends have met while using ROS.

@ican9595
Copy link

ican9595 commented Jan 26, 2021

Hello mate,

I get a very similiar error everytime I try to run rviz.

rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-kiU5_5/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61) [ERROR] [1611676995.390507822]: Unable to create the rendering window after 100 tries. [ INFO] [1611676995.390567550]: Stereo is NOT SUPPORTED terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not valid Abgebrochen (Speicherabzug geschrieben)

do you know how I can fix this problem? I have tried several NVIDIA drivers but none of them worked. Right now I am using 340.108.

Thanks in advance.

@Tiryoh
Copy link

Tiryoh commented May 23, 2021

I've got the similar error launching RViz using docker-compose.

Error:

[ WARN] [1621762443.881254292]: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)

Environment:

$ docker-compose --version --short
docker-compose version 1.27.4, build 40524192

$ docker --version
Docker version 20.10.4, build d3cb89e

$ dpkg -l | grep nvidia-docker2
ii  nvidia-docker2                                     2.6.0-1                                          all          nvidia-docker CLI wrapper

$ nvidia-smi | head -n 4
Sun May 23 18:43:41 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.39       Driver Version: 460.39       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+

In my case, adding the followings to the docker-compose.yaml solved the problem.

services: 
  test:
    image: osrf/ros:melodic-desktop-full
    command: [ "roslaunch", "urdf_tutorial", "display.launch" ]
+   runtime: nvidia
    environment:
      DISPLAY: :1
+     NVIDIA_VISIBLE_DEVICES: all
+     NVIDIA_DRIVER_CAPABILITIES: all
    volumes:
      - "/tmp/.X11-unix:/tmp/.X11-unix:rw"

According to the official document, docker-compose requires adding runtime: nvidia to access GPU.

Document: https://docs.docker.com/compose/gpu-support/

Ref: docker/compose#6691 (comment)

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

No branches or pull requests

5 participants