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

Segmentation fault (core dumped) #2357

Closed
romanw opened this issue Mar 28, 2018 · 16 comments
Closed

Segmentation fault (core dumped) #2357

romanw opened this issue Mar 28, 2018 · 16 comments

Comments

@romanw
Copy link

romanw commented Mar 28, 2018

The following code causes openscad (both git and release versions) to segfault...

$fn=96;

difference() {
cube([12, 12, 2], center=true);
cube([8, 8, 2], center=true);
}

Regardless of the correctness of the above code, openscad should handle it gracefully and not segfault.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@romanw
Copy link
Author

romanw commented Mar 28, 2018

Seems to be opengl related. Can workaround it with...

LIBGL_ALWAYS_SOFTWARE=1 openscad

Alternatively, as per the FAQ, Edit->Preferences->Advanced->Force Goldfeather, appears to improve the situation.

@t-paul
Copy link
Member

t-paul commented Mar 28, 2018

Sounds like a duplicate of #2041. Are we talking about Windows? Which OpenSCAD version? If yes, please share the info from the Event Viewer.

@romanw
Copy link
Author

romanw commented Mar 31, 2018

Linux 4.15 running on an old HP 6715s laptop which has...

VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RS690M [Radeon Xpress 1200/1250/1270]

Graphics driver is xf86-video-ati 1:18.0.1

Output of glxinfo in attached file --> glxinfo.txt

OpenSCAD versions 2015.03.03 and 20180324.

@t-paul
Copy link
Member

t-paul commented Apr 1, 2018

  1. What distribution is that? Linux 4.15 sounds just like the kernel version?
  2. Are those the builds downloaded from the main web page and OBS as linked there?
  3. Please post the output Help->LibraryInfo
  4. Do you know how to get a backtrace of the crash? gdb openscad and such?

@MichaelAtOz
Copy link
Member

@t-paul if you feed me some info on what info you want in an issue I can add it to the pinned post.

@t-paul
Copy link
Member

t-paul commented Apr 1, 2018

@MichaelAtOz Good idea, maybe just link this FAQ entry? That way we need to update just one place if we want to improve the text.

@thehans
Copy link
Member

thehans commented Apr 1, 2018

@t-paul @MichaelAtOz your recent comments make me think some github guidelines etc would be helpful, so I've created issue #2364 for some further discussion.

@romanw
Copy link
Author

romanw commented Apr 5, 2018

Regarding the questions...

  1. The distribution is ArchLinux

  2. I initially used the OpenSCAD version (2015.03.03) provided by ArchLinux (https://www.archlinux.org/packages/community/x86_64/openscad/). After that I tried the git version from the ArchLinux User Repository (https://aur.archlinux.org/packages/openscad-git).

  3. Output from Help->LibraryInfo ...

    OpenSCAD Version: 20180324
    System information: Linux 4.15.14-1-zen #1 ZEN SMP PREEMPT Wed Mar 28 17:43:56 UTC 2018 
    x86_64 Arch Linux 2 CPUs 3.73 GB RAM
    Compiler: GCC "7.3.1 20180312" 64bit
    Boost version: 1_66
    Eigen version: 3.3.4
    CGAL version, kernels: 4.11, Cartesian, Extended_cartesian, Epeck
    OpenCSG version: OpenCSG 1.4.2
    Qt version: 5.10.1
    QScintilla version: 2.10.3
    MingW build: No
    GLib version: 2.56.0
    libzip version: 
    Application Path: /usr/bin
    Documents Path: /home/user/.local/share
    Resource Path: /usr/share/openscad
    User Library Path: /home/user/.local/share/OpenSCAD/libraries
    User Config Path: /home/user/.config/OpenSCAD
    Backup Path: /home/user/.local/share/OpenSCAD/backups
    OPENSCADPATH: 
    OpenSCAD library path:
    /home/user/.local/share/OpenSCAD/libraries
    /usr/share/openscad/libraries
    
    OPENSCAD_FONT_PATH: 
    OpenSCAD font path:
    GLEW version: 2.1.0
    OpenGL Version: 2.1 Mesa 17.3.7
    GL Renderer: ATI RS690
    GL Vendor: X.Org R300 Project
    RGBA(8880), depth(24), stencil(8)
    GL_ARB_framebuffer_object: yes
    GL_EXT_framebuffer_object: yes
    GL_EXT_packed_depth_stencil: yes
    
    Qt graphics widget: QGLWidgetGL Extensions:
    GL_AMD_shader_trinary_minmax
    GL_ANGLE_texture_compression_dxt3
    GL_ANGLE_texture_compression_dxt5
    GL_APPLE_packed_pixels
    GL_ARB_ES2_compatibility
    GL_ARB_buffer_storage
    GL_ARB_clear_buffer_object
    GL_ARB_clip_control
    GL_ARB_compressed_texture_pixel_storage
    GL_ARB_copy_buffer
    GL_ARB_debug_output
    GL_ARB_depth_texture
    GL_ARB_draw_buffers
    GL_ARB_draw_elements_base_vertex
    GL_ARB_explicit_attrib_location
    GL_ARB_explicit_uniform_location
    GL_ARB_fragment_coord_conventions
    GL_ARB_fragment_program
    GL_ARB_fragment_program_shadow
    GL_ARB_fragment_shader
    GL_ARB_framebuffer_object
    GL_ARB_get_program_binary
    GL_ARB_get_texture_sub_image
    GL_ARB_half_float_pixel
    GL_ARB_half_float_vertex
    GL_ARB_instanced_arrays
    GL_ARB_internalformat_query
    GL_ARB_internalformat_query2
    GL_ARB_invalidate_subdata
    GL_ARB_map_buffer_alignment
    GL_ARB_map_buffer_range
    GL_ARB_multi_bind
    GL_ARB_multisample
    GL_ARB_multitexture
    GL_ARB_occlusion_query
    GL_ARB_occlusion_query2
    GL_ARB_pixel_buffer_object
    GL_ARB_point_parameters
    GL_ARB_point_sprite
    GL_ARB_program_interface_query
    GL_ARB_provoking_vertex
    GL_ARB_robustness
    GL_ARB_sampler_objects
    GL_ARB_separate_shader_objects
    GL_ARB_shader_objects
    GL_ARB_shading_language_100
    GL_ARB_shadow
    GL_ARB_sync
    GL_ARB_texture_barrier
    GL_ARB_texture_border_clamp
    GL_ARB_texture_compression
    GL_ARB_texture_cube_map
    GL_ARB_texture_env_add
    GL_ARB_texture_env_combine
    GL_ARB_texture_env_crossbar
    GL_ARB_texture_env_dot3
    GL_ARB_texture_filter_anisotropic
    GL_ARB_texture_float
    GL_ARB_texture_mirror_clamp_to_edge
    GL_ARB_texture_mirrored_repeat
    GL_ARB_texture_non_power_of_two
    GL_ARB_texture_rectangle
    GL_ARB_texture_rg
    GL_ARB_texture_storage
    GL_ARB_texture_swizzle
    GL_ARB_transpose_matrix
    GL_ARB_vertex_array_bgra
    GL_ARB_vertex_array_object
    GL_ARB_vertex_attrib_binding
    GL_ARB_vertex_buffer_object
    GL_ARB_vertex_program
    GL_ARB_vertex_shader
    GL_ARB_vertex_type_10f_11f_11f_rev
    GL_ARB_vertex_type_2_10_10_10_rev
    GL_ARB_window_pos
    GL_ATI_blend_equation_separate
    GL_ATI_draw_buffers
    GL_ATI_fragment_shader
    GL_ATI_separate_stencil
    GL_ATI_texture_compression_3dc
    GL_ATI_texture_env_combine3
    GL_ATI_texture_float
    GL_ATI_texture_mirror_once
    GL_EXT_abgr
    GL_EXT_bgra
    GL_EXT_blend_color
    GL_EXT_blend_equation_separate
    GL_EXT_blend_func_separate
    GL_EXT_blend_minmax
    GL_EXT_blend_subtract
    GL_EXT_compiled_vertex_array
    GL_EXT_copy_texture
    GL_EXT_draw_range_elements
    GL_EXT_fog_coord
    GL_EXT_framebuffer_blit
    GL_EXT_framebuffer_multisample
    GL_EXT_framebuffer_multisample_blit_scaled
    GL_EXT_framebuffer_object
    GL_EXT_gpu_program_parameters
    GL_EXT_multi_draw_arrays
    GL_EXT_packed_depth_stencil
    GL_EXT_packed_pixels
    GL_EXT_pixel_buffer_object
    GL_EXT_point_parameters
    GL_EXT_polygon_offset
    GL_EXT_provoking_vertex
    GL_EXT_rescale_normal
    GL_EXT_secondary_color
    GL_EXT_separate_specular_color
    GL_EXT_shadow_funcs
    GL_EXT_stencil_two_side
    GL_EXT_stencil_wrap
    GL_EXT_subtexture
    GL_EXT_texture
    GL_EXT_texture3D
    GL_EXT_texture_compression_dxt1
    GL_EXT_texture_compression_s3tc
    GL_EXT_texture_cube_map
    GL_EXT_texture_edge_clamp
    GL_EXT_texture_env_add
    GL_EXT_texture_env_combine
    GL_EXT_texture_env_dot3
    GL_EXT_texture_filter_anisotropic
    GL_EXT_texture_lod_bias
    GL_EXT_texture_mirror_clamp
    GL_EXT_texture_object
    GL_EXT_texture_rectangle
    GL_EXT_texture_sRGB
    GL_EXT_texture_sRGB_decode
    GL_EXT_texture_snorm
    GL_EXT_texture_swizzle
    GL_EXT_vertex_array
    GL_EXT_vertex_array_bgra
    GL_IBM_multimode_draw_arrays
    GL_IBM_rasterpos_clip
    GL_IBM_texture_mirrored_repeat
    GL_INGR_blend_func_separate
    GL_KHR_context_flush_control
    GL_KHR_debug
    GL_KHR_no_error
    GL_MESA_pack_invert
    GL_MESA_texture_signed_rgba
    GL_MESA_window_pos
    GL_MESA_ycbcr_texture
    GL_NV_blend_square
    GL_NV_conditional_render
    GL_NV_fog_distance
    GL_NV_light_max_exponent
    GL_NV_packed_depth_stencil
    GL_NV_primitive_restart
    GL_NV_texgen_reflection
    GL_NV_texture_barrier
    GL_NV_texture_env_combine4
    GL_NV_texture_rectangle
    GL_OES_EGL_image
    GL_OES_read_format
    GL_S3_s3tc
    GL_SGIS_generate_mipmap
    GL_SGIS_texture_border_clamp
    GL_SGIS_texture_edge_clamp
    GL_SGIS_texture_lod
    GL_SUN_multi_draw_arrays
    
  4. I'll try to get a backtrace and post in a seperate comment.

I guess I should have RTFW before opening this issue. Sorry.

@romanw
Copy link
Author

romanw commented Apr 5, 2018

Backtrace of the crash...

$ gdb openscad
GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from openscad...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/openscad 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe97c2700 (LWP 10191)]
qt5ct: using qt5ct plugin
[New Thread 0x7fffe2f85700 (LWP 10192)]
[New Thread 0x7fffd71d5700 (LWP 10193)]
qt5ct: custom style sheet is disabled
qt5ct: D-Bus global menu: no

Thread 1 "openscad" received signal SIGSEGV, Segmentation fault.
0x00007fffe8035774 in ?? ()
(gdb) bt
#0  0x00007fffe8035774 in ?? ()
#1  0x3f8000003f800000 in ?? ()
#2  0x3f8000003f800000 in ?? ()
#3  0x0000000000000000 in ?? ()
(gdb) 

@henwist
Copy link
Contributor

henwist commented Sep 3, 2018

I have looked deeper into the code regarding this segfault. I found that it is the ATI driver for old (2006 in my case) graphics cards in combination with mesa that triggers this error.

Library info from OpenSCAD:
OpenSCAD Version: 2015.03-3
System information: Linux 4.17.7-200.fc28.x86_64 #1 SMP Tue Jul 17 16:28:31 UTC 2018 x86_64 Fedora 28 (Twenty Eight) 1 CPU 3.60 GB RAM
Compiler: GCC "8.0.1 20180324 (Red Hat 8.0.1-0.20)" 64bit
Boost version: 1_66
Eigen version: 3.3.4
CGAL version, kernels: 4.11.1, Cartesian, Extended_cartesian, Epeck
OpenCSG version: OpenCSG 1.4.2
Qt version: 4.8.7
QScintilla version: 2.10.2
MingW build: No
GLib version: 2.56.1
Application Path: /usr/bin
Documents Path: /home/liveuser/.local/share
Resource Path: /usr/share/openscad
User Library Path: /home/liveuser/.local/share/OpenSCAD/libraries
User Config Path: /home/liveuser/.config/OpenSCAD
Backup Path: /home/liveuser/.local/share/OpenSCAD/backups
OPENSCADPATH:
OpenSCAD library path:
/home/liveuser/.local/share/OpenSCAD/libraries
/usr/share/openscad/libraries

OPENSCAD_FONT_PATH:
OpenSCAD font path:
GLEW version: 2.0.0
OpenGL Version: 2.1 Mesa 18.0.5
GL Renderer: ATI RS480
GL Vendor: X.Org R300 Project
RGBA(8880), depth(24), stencil(8)
GL_ARB_framebuffer_object: yes
GL_EXT_framebuffer_object: yes
GL_EXT_packed_depth_stencil: yes

Using QGLWidget

GL Extensions:
GL_AMD_shader_trinary_minmax
GL_ANGLE_texture_compression_dxt3
GL_ANGLE_texture_compression_dxt5
GL_APPLE_packed_pixels
GL_ARB_ES2_compatibility
GL_ARB_buffer_storage
GL_ARB_clear_buffer_object
GL_ARB_clip_control
GL_ARB_compressed_texture_pixel_storage
GL_ARB_copy_buffer
GL_ARB_debug_output
GL_ARB_depth_texture
GL_ARB_draw_buffers
GL_ARB_draw_elements_base_vertex
GL_ARB_explicit_attrib_location
GL_ARB_explicit_uniform_location
GL_ARB_fragment_coord_conventions
GL_ARB_fragment_program
GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader
GL_ARB_framebuffer_object
GL_ARB_get_program_binary
GL_ARB_get_texture_sub_image
GL_ARB_half_float_pixel
GL_ARB_half_float_vertex
GL_ARB_instanced_arrays
GL_ARB_internalformat_query
GL_ARB_internalformat_query2
GL_ARB_invalidate_subdata
GL_ARB_map_buffer_alignment
GL_ARB_map_buffer_range
GL_ARB_multi_bind
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_occlusion_query
GL_ARB_occlusion_query2
GL_ARB_pixel_buffer_object
GL_ARB_point_parameters
GL_ARB_point_sprite
GL_ARB_program_interface_query
GL_ARB_provoking_vertex
GL_ARB_robustness
GL_ARB_sampler_objects
GL_ARB_separate_shader_objects
GL_ARB_shader_objects
GL_ARB_shading_language_100
GL_ARB_shadow
GL_ARB_sync
GL_ARB_texture_barrier
GL_ARB_texture_border_clamp
GL_ARB_texture_compression
GL_ARB_texture_cube_map
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_texture_filter_anisotropic
GL_ARB_texture_float
GL_ARB_texture_mirror_clamp_to_edge
GL_ARB_texture_mirrored_repeat
GL_ARB_texture_non_power_of_two
GL_ARB_texture_rectangle
GL_ARB_texture_rg
GL_ARB_texture_storage
GL_ARB_transpose_matrix
GL_ARB_vertex_array_bgra
GL_ARB_vertex_array_object
GL_ARB_vertex_attrib_binding
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_vertex_shader
GL_ARB_vertex_type_10f_11f_11f_rev
GL_ARB_vertex_type_2_10_10_10_rev
GL_ARB_window_pos
GL_ATI_blend_equation_separate
GL_ATI_draw_buffers
GL_ATI_fragment_shader
GL_ATI_separate_stencil
GL_ATI_texture_env_combine3
GL_ATI_texture_float
GL_ATI_texture_mirror_once
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_blend_color
GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_compiled_vertex_array
GL_EXT_copy_texture
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample
GL_EXT_framebuffer_multisample_blit_scaled
GL_EXT_framebuffer_object
GL_EXT_gpu_program_parameters
GL_EXT_multi_draw_arrays
GL_EXT_packed_depth_stencil
GL_EXT_packed_pixels
GL_EXT_pixel_buffer_object
GL_EXT_point_parameters
GL_EXT_polygon_offset
GL_EXT_provoking_vertex
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_specular_color
GL_EXT_shadow_funcs
GL_EXT_stencil_two_side
GL_EXT_stencil_wrap
GL_EXT_subtexture
GL_EXT_texture
GL_EXT_texture3D
GL_EXT_texture_compression_dxt1
GL_EXT_texture_compression_s3tc
GL_EXT_texture_cube_map
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_add
GL_EXT_texture_env_combine
GL_EXT_texture_env_dot3
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_lod_bias
GL_EXT_texture_mirror_clamp
GL_EXT_texture_object
GL_EXT_texture_rectangle
GL_EXT_texture_sRGB
GL_EXT_texture_sRGB_decode
GL_EXT_texture_snorm
GL_EXT_vertex_array
GL_EXT_vertex_array_bgra
GL_IBM_multimode_draw_arrays
GL_IBM_rasterpos_clip
GL_IBM_texture_mirrored_repeat
GL_INGR_blend_func_separate
GL_KHR_context_flush_control
GL_KHR_debug
GL_KHR_no_error
GL_MESA_pack_invert
GL_MESA_texture_signed_rgba
GL_MESA_window_pos
GL_MESA_ycbcr_texture
GL_NV_blend_square
GL_NV_conditional_render
GL_NV_fog_distance
GL_NV_light_max_exponent
GL_NV_packed_depth_stencil
GL_NV_primitive_restart
GL_NV_texgen_reflection
GL_NV_texture_barrier
GL_NV_texture_env_combine
GL_NV_texture_rectangle
GL_OES_EGL_image
GL_OES_read_format
GL_S3_s3tc
GL_SGIS_generate_mipmap
GL_SGIS_texture_border_clamp
GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod
GL_SUN_multi_draw_arrays

My two breakpoints for debugging with GDB:
6 breakpoint keep n 0x0000555555766300 in OpenCSGPrim::render() at src/OpenCSGRenderer.cc:44
breakpoint already hit 5 times

Breakpoint 15, llvm_pipeline_generic (middle=0x555555ddd370, fetch_info=fetch_info@entry=0x7fffffffaa00,
in_prim_info=in_prim_info@entry=0x7fffffffaa20) at draw/draw_pt_fetch_shade_pipeline_llvm.c:400
400 clipped = fpme->current_variant->jit_func(&fpme->llvm->jit_context,

The backtrace just before hitting the function that triggers the segfault:
#0 0x00007fffd2229713 in llvm_pipeline_generic (middle=
0x555555ddd370, fetch_info=fetch_info@entry=0x7fffffffaa00, in_prim_info=in_prim_info@entry=0x7fffffffaa20)
at draw/draw_pt_fetch_shade_pipeline_llvm.c:400
#1 0x00007fffd2229c31 in llvm_middle_end_linear_run (middle=, start=, count=, prim_flags=) at draw/draw_pt_fetch_shade_pipeline_llvm.c:553
#2 0x00007fffd2145f4a in vsplit_segment_simple_linear (vsplit=0x5555562d6a20, icount=36, istart=0, flags=0)
at draw/draw_pt_vsplit_tmp.h:226
#3 0x00007fffd2145f4a in vsplit_run_linear (frontend=0x5555562d6a20, start=0, count=36) at draw/draw_split_tmp.h:60
#4 0x00007fffd213efc2 in draw_pt_arrays (draw=draw@entry=0x5555562c0100, prim=4, start=0, count=count@entry=36)
at draw/draw_pt.c:149
#5 0x00007fffd213f4a8 in draw_vbo (draw=0x5555562c0100, info=0x7fffffffab50, info@entry=0x7fffffffac10)
at draw/draw_pt.c:564
#6 0x00007fffd2368a0d in r300_swtcl_draw_vbo (pipe=0x555556297270, info=0x7fffffffac10) at r300_render.c:862
#7 0x00007fffd1f9ca2f in st_draw_vbo (ctx=, prims=0x5555563ce370, nr_prims=, ib=0x0, index_bounds_valid=, min_index=, max_index=, tfb_vertcount=0x0, stream=0, indirect=0x0)
at state_tracker/st_draw.c:227
#8 0x00007fffd1f6288a in vbo_exec_vtx_flush (exec=exec@entry=0x5555563cdb70, keepUnmapped=keepUnmapped@entry=1 '\001')
at vbo/vbo_context.h:91
#9 0x00007fffd1f5f54b in vbo_exec_FlushVertices_internal (unmap=1 '\001', exec=) at vbo/vbo_exec_api.c:1299
#10 0x00007fffd1f5f54b in vbo_exec_FlushVertices (ctx=ctx@entry=0x555556391f20, flags=flags@entry=1)
at vbo/vbo_exec_api.c:1299
#11 0x00007fffd1eda155 in _mesa_PopMatrix () at main/matrix.c:287
#12 0x0000555555766372 in OpenCSGPrim::render() (this=0x555556edd910) at src/OpenCSGRenderer.cc:48
#13 0x00007ffff74cba7a in OpenCSG::(anonymous namespace)::SCSChannelManagerFragmentProgram::merge() (this=0x5555564e3330)
at renderSCS.cpp:254
#14 0x00007ffff74cb1a4 in OpenCSG::renderSCS(std::vector<OpenCSG::Primitive*, std::allocatorOpenCSG::Primitive* > const&, OpenCSG::DepthComplexityAlgorithm) (primitives=std::vector of length 2, capacity 2 = {...}, algorithm=)
at renderSCS.cpp:640
#15 0x0000555555765f9a in OpenCSGRenderer::renderCSGChain(CSGChain*, int*, bool, bool) const (this=0x55555650b300, chain=0x555556687fc0, shaderinfo=0x555555e6b6b0, highlight=false, background=false) at src/OpenCSGRenderer.cc:84
#16 0x00005555557661a6 in OpenCSGRenderer::draw(bool, bool) const (this=0x55555650b300, showedges=)
at src/OpenCSGRenderer.cc:64
#17 0x00005555556b6c23 in GLView::paintGL() (this=this@entry=0x555555e6b5c8) at src/GLView.cc:189
#18 0x00005555556b8e1e in QGLView::paintGL() (this=0x555555e6b5a0) at src/QGLView.cc:162
#19 0x00007ffff510f9e5 in QGLWidget::glDraw() () at /lib64/libQtOpenGL.so.4
#20 0x000055555573a82d in MainWindow::csgRender() (this=0x555555db5f80) at src/mainwin.cc:1822
#21 0x00005555558b3c70 in MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=, _c=, _id=, _a=) at objects/moc_MainWindow.cpp:275
#22 0x00007ffff3fbfe12 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () at /lib64/libQtCore.so.4
#23 0x00007ffff3fc0e92 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () at /lib64/libQtCore.so.4
#24 0x000055555572f6b5 in QMetaObject::invokeMethod(QObject*, char const*, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., member=, obj=0x555555db5f80) at /usr/include/QtCore/qobjectdefs.h:433
#25 0x000055555572f6b5 in MainWindow::compileDone(bool) (this=this@entry=0x555555db5f80, didchange=didchange@entry=true)
at src/mainwin.cc:1060
#26 0x000055555573984a in MainWindow::compile(bool, bool) (this=0x555555db5f80, reload=false, forcedone=false)
at src/mainwin.cc:989
#27 0x0000555555739c95 in MainWindow::actionRenderPreview() (this=0x555555db5f80) at src/mainwin.cc:1809
#28 0x00005555558b3c66 in MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=, _c=, _id=, _a=) at objects/moc_MainWindow.cpp:274
#29 0x00007ffff3fcb1b0 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () at /lib64/libQtCore.so.4
#30 0x00007ffff459ffe6 in QAction::triggered(bool) () at /lib64/libQtGui.so.4
#31 0x00007ffff45a139f in QAction::activate(QAction::ActionEvent) () at /lib64/libQtGui.so.4
#32 0x00007ffff45a18c4 in QAction::event(QEvent*) () at /lib64/libQtGui.so.4
#33 0x00007ffff45a5df0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQtGui.so.4
#34 0x00007ffff45ac852 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQtGui.so.4
#35 0x00007ffff3fb699f in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /lib64/libQtCore.so.4
#36 0x00007ffff45dbf09 in () at /lib64/libQtGui.so.4
#37 0x00007ffff45dc11c in () at /lib64/libQtGui.so.4
#38 0x00007ffff45ae2e4 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQtGui.so.4
#39 0x00007ffff3fb699f in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /lib64/libQtCore.so.4
#40 0x00007ffff4646431 in () at /lib64/libQtGui.so.4
#41 0x00007ffff46467b6 in () at /lib64/libQtGui.so.4
#42 0x00007ffff462163f in QApplication::x11ProcessEvent(_XEvent*) () at /lib64/libQtGui.so.4
#43 0x00007ffff4648cfe in () at /lib64/libQtGui.so.4
#44 0x00007ffff636e8ad in g_main_dispatch (context=0x555555cbad10) at gmain.c:3177
#45 0x00007ffff636e8ad in g_main_context_dispatch (context=context@entry=0x555555cbad10) at gmain.c:3830
#46 0x00007ffff636ec78 in g_main_context_iterate (context=context@entry=0x555555cbad10, block=block@entry=1, dispatch=dispatch@entry=1, self=) at gmain.c:3903
#47 0x00007ffff636ed10 in g_main_context_iteration (context=0x555555cbad10, may_block=1) at gmain.c:3964
#48 0x00007ffff3fe4be9 in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) ()
at /lib64/libQtCore.so.4
#49 0x00007ffff4648e8b in () at /lib64/libQtGui.so.4
#50 0x00007ffff3fb5153 in QEventLoop::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () at /lib64/libQtCore.so.4
#51 0x00007ffff3fb542e in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () at /lib64/libQtCore.so.4
#52 0x00007ffff3fba96e in QCoreApplication::exec() () at /lib64/libQtCore.so.4
#53 0x000055555571b513 in gui(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&, boost::filesystem::path const&, int, char**) () at src/openscad.cc:748
#54 0x00005555555cdb4b in main () at src/openscad.cc:921

The function inside mesa library that triggers segfault:
`static void
llvm_pipeline_generic(struct draw_pt_middle_end *middle,
const struct draw_fetch_info *fetch_info,
const struct draw_prim_info *in_prim_info)
{
struct llvm_middle_end *fpme = llvm_middle_end(middle);
struct draw_context *draw = fpme->draw;
struct draw_geometry_shader *gshader = draw->gs.geometry_shader;
struct draw_prim_info gs_prim_info;
struct draw_vertex_info llvm_vert_info;
struct draw_vertex_info gs_vert_info;
struct draw_vertex_info *vert_info;
struct draw_prim_info ia_prim_info;
struct draw_vertex_info ia_vert_info;
const struct draw_prim_info *prim_info = in_prim_info;
boolean free_prim_info = FALSE;
unsigned opt = fpme->opt;
boolean clipped = 0;
unsigned start_or_maxelt, vid_base;
const unsigned *elts;

assert(fetch_info->count > 0);
llvm_vert_info.count = fetch_info->count;
llvm_vert_info.vertex_size = fpme->vertex_size;
llvm_vert_info.stride = fpme->vertex_size;
llvm_vert_info.verts = (struct vertex_header *)
MALLOC(fpme->vertex_size *
align(fetch_info->count, lp_native_vector_width / 32));
if (!llvm_vert_info.verts) {
assert(0);
return;
}
c
if (draw->collect_statistics) {
draw->statistics.ia_vertices += prim_info->count;
draw->statistis.ia_primitives +=
u_decomposed_prims_for_vertices(prim_info->prim, prim_info->count);
draw->statistics.vs_invocations += fetch_info->count;
}

if (fetch_info->linear) {
start_or_maxelt = fetch_info->start;
vid_base = draw->start_index;
elts = NULL;
}
else {
start_or_maxelt = draw->pt.user.eltMax;
vid_base = draw->pt.user.eltBias;
elts = fetch_info->elts;
}
SEGFAULTS HERE ----->>>>>> clipped = fpme->current_variant->jit_func(&fpme->llvm->jit_context,
llvm_vert_info.verts,
draw->pt.user.vbuffer,
fetch_info->count,
start_or_maxelt,
fpme->vertex_size,
draw->pt.vertex_buffer,
draw->instance_id,
vid_base,
draw->start_instance,
elts);

/* Finished with fetch and vs:
*/
fetch_info = NULL;
vert_info = &llvm_vert_info;

if ((opt & PT_SHADE) && gshader) {
struct draw_vertex_shader *vshader = draw->vs.vertex_shader;
draw_geometry_shader_run(gshader,
draw->pt.user.gs_constants,
draw->pt.user.gs_constants_size,
vert_info,
prim_info,
&vshader->info,
&gs_vert_info,
&gs_prim_info);

  FREE(vert_info->verts);
  vert_info = &gs_vert_info;
  prim_info = &gs_prim_info;

} else {
if (draw_prim_assembler_is_required(draw, prim_info, vert_info)) {
draw_prim_assembler_run(draw, prim_info, vert_info,
&ia_prim_info, &ia_vert_info);

     if (ia_vert_info.count) {
        FREE(vert_info->verts);
        vert_info = &ia_vert_info;
        prim_info = &ia_prim_info;
        free_prim_info = TRUE;
     }
  }

}
if (prim_info->count == 0) {
debug_printf("GS/IA didn't emit any vertices!\n");

  FREE(vert_info->verts);
  if (free_prim_info) {
     FREE(prim_info->primitive_lengths);
  }
  return;

}

/* stream output needs to be done before clipping */
draw_pt_so_emit( fpme->so_emit, vert_info, prim_info );

draw_stats_clipper_primitives(draw, prim_info);

/*
* if there's no position, need to stop now, or the latter stages
* will try to access non-existent position output.
/
if (draw_current_shader_position_output(draw) != -1) {
if ((opt & PT_SHADE) && (gshader ||
draw->vs.vertex_shader->info.writes_viewport_index)) {
clipped = draw_pt_post_vs_run( fpme->post_vs, vert_info, prim_info );
}
/
"clipped" also includes non-one edgeflag */
if (clipped) {
opt |= PT_PIPELINE;
}

  /* Do we need to run the pipeline? Now will come here if clipped
   */
  if (opt & PT_PIPELINE) {
     pipeline( fpme, vert_info, prim_info );
  }
  else {
     emit( fpme->emit, vert_info, prim_info );
  }

}
FREE(vert_info->verts);
if (free_prim_info) {
FREE(prim_info->primitive_lengths);
}
}`

This line will segfault deep deep inside mesa library:
/usr/src/debug/mesa-18.0.5-3.fc28.x86_64/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:400: clipped = fpme->current_variant->jit_func(&fpme->llvm->jit_context, ...

I cannot see how to trace inside jit_func , but somebody may seek deeper in mesa... anyway this segfault seems to be in mesa so older hardware with ATI drivers combined with mesa doesn't work - e.g:
OpenGL Version: 2.1 Mesa 18.0.5
GL Renderer: ATI RS480
GL Vendor: X.Org R300 Project.

GL Renderer: llvmpipe with mesa and ATI works though.

So a conclusion all in all as I see it: - the bug is most probably a mesa bug with X.Org R300 Project for the GL Renderer : ATI RSnnn.

/Henrik

@donbright
Copy link
Sponsor Member

thanks @henwist

i have seen this happen too... i think we should explore the idea of blacklist that auto-switches to software rendering for certain cards (on windows QT this can be done also with QT_ANGLE_PLATFORM=warp , on linux at the least LIBGL_ALWAYS_SOFTWARE=1 ) ..

@nophead
Copy link
Member

nophead commented Sep 3, 2018

Perhaps a preference the user could change, like Force Goldfeather. That way it doesn't need a new addition to the blacklist each time a user comes across a problem. They can just flip the switch to see if software rendering fixes it.

@donbright
Copy link
Sponsor Member

thats a good point however this type of error can crash OpenSCAD on startup so the user doesnt have a chance to see any switch they can flip, it just crashes without explanation.

@nophead
Copy link
Member

nophead commented Sep 3, 2018

Perhaps an environment variable to force it on?

@donbright
Copy link
Sponsor Member

a program should never crash on startup.

this is why web browsers and other projects have 'blacklists' of GPUs where they force software rendering (the user can try to use the terrible drivers if they want by overriding the blacklist)

https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/AQNCH7plJe4

mavlink/qgroundcontrol#2776

https://stackoverflow.com/questions/34796504/what-happens-to-blacklisted-graphic-cards-in-qt-5-6-when-running-a-qml-app

@kintel
Copy link
Member

kintel commented Dec 7, 2018

Closing as driver bug. If someone wants to play with blacklisting, we can open a feature request for that.

@kintel kintel closed this as completed Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants