Segfault / hang on shutdown when rendering from script (NVidia driver bug?)
Closed, ArchivedPublic


I was toying around with rendering a set of frames from a Python script:

import bpy

scene = bpy.context.scene
render = scene.render

render.resolution_x = 960
render.resolution_y = 540
render.resolution_percentage = 100
render.image_settings.file_format = 'PNG'

for frame in [1, 4, 6]:
scene.frame_current = frame
render.filepath = '/tmp/doh%04d.png' % frame
bpy.ops.render.render(write_still=True, animation=False)

When I run this script with blender -b -P ./ the rendering
sometimes hangs at exit, sometimes segfaults at exit and sometimes succeeds.
I tried to get some stacktraces, seems to be something to do with shutdown
and unloading NVidia libraries:

Hang (stack trace from gdb -p <pid>):

(gdb) bt
#0 0x00007f44f1754c21 in _nv012tls ()
from /usr/lib/tls/
#1 0x00007f44f72bce33 in ?? () from /usr/lib/
#2 0x00007f44f729c379 in ?? () from /usr/lib/
#3 0x00007f44f753c3ec in _dl_fini () at dl-fini.c:248
#4 0x00007f44f2038262 in __run_exit_handlers (status=0) at exit.c:78
#5 *__GI_exit (status=0) at exit.c:100
#6 0x00000000007f9478 in WM_exit (C=<value optimized out>)
at /home/paulmlocal/c/blender-svn/source/blender/windowmanager/intern/wm_init_exit.c:463
#7 0x00000000007eefb8 in main (argc=4, argv=0x7fffef4d41f8)
at /home/paulmlocal/c/blender-svn/source/creator/creator.c:1247


(gdb) bt
#0 0x00007f0011181a08 in _nv007tls () from /usr/lib/tls/
#1 0x00007f0015c9ea61 in __nptl_deallocate_tsd (arg=<value optimized out>) at pthread_create.c:155
#2 start_thread (arg=<value optimized out>) at pthread_create.c:307
#3 0x00007f0011b1270d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4 0x0000000000000000 in ?? ()

Blender info:

Blender 2.60 (sub 5)
build date: 2011-11-24
build time: 13:16:12
build revision: 42122
build platform: Linux
build type: RelWithDebInfo
build c flags: -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings
build c++ flags: -D__STDC_CONSTANT_MACROS -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wno-invalid-offsetof -Wno-sign-compare
build link flags: -pthread
build system: CMake

I see this behaviour on an Ubuntu 10.04, x86_64 system with NVidia 285.05.09 drivers. Tried with newer drivers, 290.10, but same problem.
This might be a driver issue, as I don't see this happening on a different system, which has NVidia 260.19.26 drivers.


OpenGL Error
Nobody (None) closed this task as Archived.Nov 24 2011, 4:03 PM

Seems to be a driver bug, i.e. see

Setting __GL_SINGLE_THREADED=1 seems to work as a work-around for me (got that one from

Indeed there's posts about this bug crashing various applications. NVidia supposedly fixed an issue with this in 285.05.09, but maybe it only works when you have a newer version. Moving to the OpenGL errors tracker, this is not something we can solve in Blender.

Moved from Blender 2.5 Bug Tracker to OpenGL errors