openscad / openscad

OpenSCAD - The Programmers Solid 3D CAD Modeller
https://www.openscad.org
Other
7.14k stars 1.22k forks source link

Using --animate: Maximum number of clients reached / Unable to open a connection to the X server. #4953

Open PinkPandaKatie opened 10 months ago

PinkPandaKatie commented 10 months ago

Describe the bug When I try to use --animate to export a lot of frames from the command line, it eventually fails with the following error:

Maximum number of clients reachedUnable to open a connection to the X server. 
DISPLAY=:0.0
Can't create OffscreenView: Unable to obtain GL Context.

It fails after about 145 frames on my laptop, but the number can vary widely based on available resources.

I have a fix for this issue which I will create a pull request for,

To Reproduce Steps to reproduce the behavior:

  1. Prepare a SCAD file with an animation
  2. Run openscad animation.scad -o test.png --animate 1000
  3. OpenSCAD fails after ~100-200 frames

Expected behavior OpenSCAD produces 1000 frames of animation.

Code reproducing the issue Any animation will reproduce the issue, such as

rotate([0, 0, 360*$t]) cube(5, center=true); 

Environment and Version info (please complete the following information):

Library & Graphics card information

OpenSCAD Version: 2023.08.20
System information: Linux 6.0.12-76060006-generic #202212290932~1671652965~22.04~452ea9d SMP PREEMPT_DYNAMIC Wed D x86_64 Pop!_OS 22.04 LTS 20 CPUs 38.88 GB RAM
User Agent: OpenSCAD/2023.08.20 (Linux x86_64; Pop!_OS 22.04 LTS)
Compiler: GCC "11.4.0" 64bit
MinGW build: No
Debug build: No
Boost version: 1_74
Eigen version: 3.4.0
CGAL version, kernels: 5.4, Cartesian<Gmpq>, Extended_cartesian<Gmpq>, Epeck
OpenCSG version: OpenCSG 1.4.2
Qt version: 5.15.3
QScintilla version: 2.11.6
InputDrivers: 
GLib version: 2.72.4
lodepng version: 20210627
libzip version: 1.7.3
fontconfig version: 2.13.1
freetype version: 2.11.1
harfbuzz version: 2.7.4
cairo version: 1.16.0
lib3mf version: (not enabled)
Features: fast-csg, fast-csg-safer, fast-csg-debug, manifold, roof, input-driver-dbus, lazy-union, vertex-object-renderers, vertex-object-renderers-indexing, vertex-object-renderers-direct, vertex-object-renderers-prealloc, textmetrics, import-function, predictible-output
Application Path: /home/ktpanda/lsrctree/git/openscad/build
Documents Path: /home/ktpanda/.local/share
User Documents Path: /home/ktpanda
Resource Path: /home/ktpanda/lsrctree/git/openscad
User Library Path: /home/ktpanda/.local/share/OpenSCAD/libraries
User Config Path: /home/ktpanda/.config/OpenSCAD
Backup Path: /home/ktpanda/.local/share/OpenSCAD/backups
OPENSCADPATH: <not set>
OpenSCAD library path:
  /home/ktpanda/.local/share/OpenSCAD/libraries
  /home/ktpanda/lsrctree/git/openscad/libraries

OPENSCAD_FONT_PATH: <not set>
OpenSCAD font path:
  /usr/share/fonts
  /usr/local/share/fonts
  /home/ktpanda/.local/share/fonts
  /home/ktpanda/.fonts
  /usr/share/texmf/fonts/opentype/public/lm
  /usr/share/texmf/fonts/opentype/public/lm-math
  /usr/share/texmf/fonts/opentype/public/tex-gyre
  /usr/share/texmf/fonts/opentype/public/tex-gyre-math
  /usr/X11/lib/X11/fonts
  /System/Library/Fonts
  /Library/Fonts
  /home/ktpanda/Library/Fonts
  /usr/share/fonts/X11
  /usr/share/fonts/cMap
  /usr/share/fonts/cmap
  /usr/share/fonts/opentype
  /usr/share/fonts/truetype
  /usr/share/fonts/type1
  /home/ktpanda/.local/share/fonts/truetype
  /usr/share/fonts/X11/100dpi
  /usr/share/fonts/X11/75dpi
  /usr/share/fonts/X11/Type1
  /usr/share/fonts/X11/encodings
  /usr/share/fonts/X11/misc
  /usr/share/fonts/X11/util
  /usr/share/fonts/cmap/adobe-cns1
  /usr/share/fonts/cmap/adobe-gb1
  /usr/share/fonts/cmap/adobe-japan1
  /usr/share/fonts/cmap/adobe-japan2
  /usr/share/fonts/cmap/adobe-korea1
  /usr/share/fonts/opentype/fira
  /usr/share/fonts/opentype/linux-libertine
  /usr/share/fonts/opentype/malayalam
  /usr/share/fonts/opentype/mathjax
  /usr/share/fonts/opentype/noto
  /usr/share/fonts/opentype/porson
  /usr/share/fonts/opentype/stix
  /usr/share/fonts/opentype/stix-word
  /usr/share/fonts/opentype/urw-base35
  /usr/share/fonts/truetype/Gargi
  /usr/share/fonts/truetype/Gubbi
  /usr/share/fonts/truetype/Nakula
  /usr/share/fonts/truetype/Navilu
  /usr/share/fonts/truetype/Sahadeva
  /usr/share/fonts/truetype/abyssinica
  /usr/share/fonts/truetype/aenigma
  /usr/share/fonts/truetype/ancient-scripts
  /usr/share/fonts/truetype/andika
  /usr/share/fonts/truetype/arphic
  /usr/share/fonts/truetype/arundina
  /usr/share/fonts/truetype/baskerville
  /usr/share/fonts/truetype/charis
  /usr/share/fonts/truetype/crosextra
  /usr/share/fonts/truetype/dejavu
  /usr/share/fonts/truetype/doulos
  /usr/share/fonts/truetype/droid
  /usr/share/fonts/truetype/dustin
  /usr/share/fonts/truetype/euterpe
  /usr/share/fonts/truetype/fonts-arabeyes
  /usr/share/fonts/truetype/fonts-beng-extra
  /usr/share/fonts/truetype/fonts-deva-extra
  /usr/share/fonts/truetype/fonts-gujr-extra
  /usr/share/fonts/truetype/fonts-guru-extra
  /usr/share/fonts/truetype/fonts-kalapi
  /usr/share/fonts/truetype/fonts-orya-extra
  /usr/share/fonts/truetype/fonts-telu-extra
  /usr/share/fonts/truetype/fonts-yrsa-rasa
  /usr/share/fonts/truetype/freefont
  /usr/share/fonts/truetype/gentium
  /usr/share/fonts/truetype/gentium-basic
  /usr/share/fonts/truetype/glyphicons
  /usr/share/fonts/truetype/horai-umefont
  /usr/share/fonts/truetype/kacst-one
  /usr/share/fonts/truetype/lao
  /usr/share/fonts/truetype/lato
  /usr/share/fonts/truetype/liberation
  /usr/share/fonts/truetype/liberation2
  /usr/share/fonts/truetype/libreoffice
  /usr/share/fonts/truetype/lohit-assamese
  /usr/share/fonts/truetype/lohit-bengali
  /usr/share/fonts/truetype/lohit-devanagari
  /usr/share/fonts/truetype/lohit-gujarati
  /usr/share/fonts/truetype/lohit-kannada
  /usr/share/fonts/truetype/lohit-malayalam
  /usr/share/fonts/truetype/lohit-oriya
  /usr/share/fonts/truetype/lohit-punjabi
  /usr/share/fonts/truetype/lohit-tamil
  /usr/share/fonts/truetype/lohit-tamil-classical
  /usr/share/fonts/truetype/lohit-telugu
  /usr/share/fonts/truetype/lyx
  /usr/share/fonts/truetype/malayalam
  /usr/share/fonts/truetype/msttcorefonts
  /usr/share/fonts/truetype/nanum
  /usr/share/fonts/truetype/noto
  /usr/share/fonts/truetype/open-sans
  /usr/share/fonts/truetype/padauk
  /usr/share/fonts/truetype/pagul
  /usr/share/fonts/truetype/povray
  /usr/share/fonts/truetype/quicksand
  /usr/share/fonts/truetype/roboto
  /usr/share/fonts/truetype/roboto-slab
  /usr/share/fonts/truetype/samyak
  /usr/share/fonts/truetype/samyak-fonts
  /usr/share/fonts/truetype/sinhala
  /usr/share/fonts/truetype/sjfonts
  /usr/share/fonts/truetype/takao-gothic
  /usr/share/fonts/truetype/teluguvijayam
  /usr/share/fonts/truetype/tibetan-machine
  /usr/share/fonts/truetype/tlwg
  /usr/share/fonts/truetype/ttf-bitstream-vera
  /usr/share/fonts/truetype/ttf-khmeros
  /usr/share/fonts/truetype/ttf-khmeros-core
  /usr/share/fonts/truetype/ubuntu
  /usr/share/fonts/truetype/unfonts-core
  /usr/share/fonts/truetype/uralic
  /usr/share/fonts/truetype/vlgothic
  /usr/share/fonts/truetype/wqy
  /usr/share/fonts/type1/gsfonts
  /usr/share/fonts/type1/texlive-fonts-recommended
  /usr/share/fonts/type1/urw-base35
  /home/ktpanda/.local/share/fonts/truetype/CPMono_v07
  /usr/share/fonts/X11/encodings/large
  /usr/share/fonts/truetype/roboto/unhinted
  /usr/share/fonts/type1/gsfonts/pmw
  /usr/share/fonts/truetype/roboto/unhinted/RobotoTTF

GL context creator: GLX (old)
GLX version: 1.4
PNG generator: lodepng

GLEW version: 2.2.0
OpenGL Version: 4.6.0 NVIDIA 515.86.01
GL Renderer: NVIDIA GeForce RTX 3070 Ti Laptop GPU/PCIe/SSE2
GL Vendor: NVIDIA Corporation
RGBA(8888), depth(24), stencil(8)
GL_ARB_framebuffer_object: yes
GL_EXT_framebuffer_object: yes
GL_EXT_packed_depth_stencil: yes
kintel commented 10 months ago

The root cause of this issue is that you're using an older version of OpenSCAD (2023.08.20), while this issue was fixed in 2023.09.09 (#4735)