3D viewer crashes KiCAD when opened

Bug #1790534 reported by Mikkel Jeppesen
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Medium
Seth Hillbrand

Bug Description

Trying to open 3D viewer for the PCB in this branch: https://github.com/Duckle29/Vitamins-included/tree/bugreport
It crashes on "build tech layers"

3D viewer works fine on smaller boards that I've tested.

System info:
Windows 10

Version info:
Application: kicad
Version: (5.0.1-dev-69-g9eec296b0), debug build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.60.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.54.1
    Compiler: GCC 7.1.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Nick Østergaard (nickoe) wrote :

Hmm, FWIW that is a debug build. But I just tested the same board on linux with master and I see the following assert thing on the console. I don't know why I don't see the usual wx assert dialog.

kicad: /home/wee/woo/kicad-src/include/geometry/polygon_triangulation.h:389: void PolygonTriangulation::earcutList(PolygonTriangulation::Vertex*, int): Assertion `aPoint->prev == aPoint->next' failed.

It looks like it shows some of the 3D viewer window frame, except for the canvas area which shows the window below. The status line in the bottom of the window shows "Build Tech Layers".

Application: kicad
Version: (6.0.0-rc1-dev-449-g202b35bc9), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 OpenSSL/1.1.0i zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) nghttp2/1.32.0
Platform: Linux 4.18.3-arch1-1-ARCH x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.67.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.0
    Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

tags: added: 3d-viewer pcbnew
Changed in kicad:
status: New → Confirmed
milestone: none → 5.0.1
importance: Undecided → High
description: updated
Revision history for this message
Nick Østergaard (nickoe) wrote :
Download full text (5.0 KiB)

Backtrace:

pcbnew: /home/nickoe/kicad-source-mirror/include/geometry/polygon_triangulation.h:389: void PolygonTriangulation::earcutList(PolygonTriangulation::Vertex*, int): Assertion `aPoint->prev == aPoint->next' failed.

Thread 1 "pcbnew" received signal SIGABRT, Aborted.
0x00007ffff48a4d7f in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff48a4d7f in raise () at /usr/lib/libc.so.6
#1 0x00007ffff488f672 in abort () at /usr/lib/libc.so.6
#2 0x00007ffff488f548 in _nl_load_domain.cold.0 () at /usr/lib/libc.so.6
#3 0x00007ffff489d396 in () at /usr/lib/libc.so.6
#4 0x00007fffea39f7b1 in PolygonTriangulation::earcutList(PolygonTriangulation::Vertex*, int) (this=0x7fffffffc950, aPoint=0x55555a827a40, pass=0) at /home/nickoe/kicad-source-mirror/include/geometry/polygon_triangulation.h:389
#5 0x00007fffea3a01c4 in PolygonTriangulation::TesselatePolygon(SHAPE_LINE_CHAIN const&) (this=0x7fffffffc950, aPoly=...) at /home/nickoe/kicad-source-mirror/include/geometry/polygon_triangulation.h:602
#6 0x00007fffea39ae20 in SHAPE_POLY_SET::CacheTriangulation() (this=0x7fffffffccb0) at /home/nickoe/kicad-source-mirror/common/geometry/shape_poly_set.cpp:1921
#7 0x00007fffea00b62f in Convert_shape_line_polygon_to_triangles(SHAPE_POLY_SET&, CGENERICCONTAINER2D&, float, BOARD_ITEM const&) (aPolyList=..., aDstContainer=..., aBiuTo3DunitsScale=3.46845859e-08, aBoardItem=...)
    at /home/nickoe/kicad-source-mirror/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/ctriangle2d.cpp:138
#8 0x00007fffe9fcbf40 in CINFO3D_VISU::AddShapeWithClearanceToContainer(DRAWSEGMENT const*, CGENERICCONTAINER2D*, PCB_LAYER_ID, int) (this=0x555557bff2b0, aDrawSegment=0x555556e959a0, aDstContainer=0x55555a3e2ae0, aLayerId=B_SilkS, aClearanceValue=0) at /home/nickoe/kicad-source-mirror/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp:833
#9 0x00007fffe9fc93ee in CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(MODULE const*, CGENERICCONTAINER2D*, PCB_LAYER_ID, int) (this=0x555557bff2b0, aModule=
    0x555556e95330, aDstContainer=0x55555a3e2ae0, aLayerId=B_SilkS, aInflateValue=0) at /home/nickoe/kicad-source-mirror/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp:210
#10 0x00007fffe9fc37a9 in CINFO3D_VISU::createLayers(REPORTER*) (this=0x555557bff2b0, aStatusTextReporter=0x7fffffffd9e0) at /home/nickoe/kicad-source-mirror/3d-viewer/3d_canvas/create_layer_items.cpp:1077
#11 0x00007fffe9fba247 in CINFO3D_VISU::InitSettings(REPORTER*) (this=0x555557bff2b0, aStatusTextReporter=0x7fffffffd9e0) at /home/nickoe/kicad-source-mirror/3d-viewer/3d_canvas/cinfo3d_visu.cpp:437
#12 0x00007fffea039606 in C3D_RENDER_OGL_LEGACY::reload(REPORTER*) (this=0x555557c03000, aStatusTextReporter=0x7fffffffd9e0)
    at /home/nickoe/kicad-source-mirror/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp:352
#13 0x00007fffe9fde644 in C3D_RENDER_OGL_LEGACY::Redraw(bool, REPORTER*) (this=0x555557c03000, aIsMoving=false, aStatusTextReporter=0x7fffffffd9e0)
    at /home/nickoe/kicad-source-mirror/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp:481
#14 0x00007fffe9fd03d4 in EDA_3D_CANVAS::OnPaint(wxPaintEvent&) (this=0x555557e08c00, eve...

Read more...

Revision history for this message
Mikkel Jeppesen (mikkeljep) wrote :
Seth Hillbrand (sethh)
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
Revision history for this message
Seth Hillbrand (sethh) wrote :
Download full text (3.8 KiB)

In 5.0, the backtrace looks a bit different (haven't replaced the tesselation in 5.0)

It looks like we have two identical silk cutouts that are not being simplified for some reason.

#0 raise (sig=5) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff6c676bd in wxGUIAppTraits::ShowAssertDialog(wxString const&) () from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#2 0x00007ffff63482d2 in ?? () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#3 0x00007ffff634bb9d in wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#4 0x00007ffff6c260d0 in wxApp::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) ()
   from /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#5 0x00007ffff634c242 in ?? () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#6 0x00007ffff634623a in wxOnAssert(char const*, int, char const*, char const*, char const*) () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7 0x00007fffdca7e9ab in CRING2D::CRING2D (this=0x55555a887fe0, aCenter=..., aInnerRadius=0.00934430491, aOuterRadius=0.00934430491, aBoardItem=...)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cring2d.cpp:38
#8 0x00007fffdca437e9 in CINFO3D_VISU::AddShapeWithClearanceToContainer (this=0x5555582eaf18, aDrawSegment=0x555558d4e0f0, aDstContainer=
    0x55555ac983d0, aLayerId=B_SilkS, aClearanceValue=0) at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp:781
#9 0x00007fffdca410a8 in CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer (this=0x5555582eaf18, aModule=0x555558b15920,
    aDstContainer=0x55555ac983d0, aLayerId=B_SilkS, aInflateValue=0)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp:212
#10 0x00007fffdca3b507 in CINFO3D_VISU::createLayers (this=0x5555582eaf18, aStatusTextReporter=0x7fffffffd540)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_canvas/create_layer_items.cpp:1080
#11 0x00007fffdca323d7 in CINFO3D_VISU::InitSettings (this=0x5555582eaf18, aStatusTextReporter=0x7fffffffd540)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_canvas/cinfo3d_visu.cpp:437
#12 0x00007fffdcabb6b8 in C3D_RENDER_OGL_LEGACY::reload (this=0x555557f34870, aStatusTextReporter=0x7fffffffd540)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp:352
#13 0x00007fffdca555bb in C3D_RENDER_OGL_LEGACY::Redraw (this=0x555557f34870, aIsMoving=false, aStatusTextReporter=0x7fffffffd540)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp:481
#14 0x00007fffdca47aa5 in EDA_3D_CANVAS::OnPaint (this=0x555557f35ba0, event=...)
    at /home/seth/code/kicad/kicad-v5/3d-viewer/3d_canvas/eda_3d_canvas.cpp:392
#15 0x00007ffff634440e in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ()
   from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#16 0x00007ffff64c9ea5 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*...

Read more...

Revision history for this message
Seth Hillbrand (sethh) wrote :

@Devs- Question for interested parties below

It turns out that this is due to OPL's QFN44 footprint using a 0-width circle for their pin 1 marker. It is not allowed by pcbnew editing, so this is likely script-generated.

The question is how best to handle this. I see a few options:

1) Replace invalid line widths when reading the file (maybe with board defaults)
2) Check for and drop zero-width circles when rendering
3) Replace zero-width with a default width when rendering.

I like option 1 best as this corrects the board. While it doesn't necessarily represent what the user intends, given that the board file is invalid, this might be acceptable. This is also how gerber output seems to behave.

Options 2/3 are the least invasive and leave board rendering intact. But they keep the mismatch between on screen and gerber render.

Thoughts?

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I think WYSIWYG is especially important when applied to PCBs, I vote for #1.

Revision history for this message
Mario Luzeiro (mrluzeiro) wrote :

I think this cases should be cleared/solved on pcbnew side.
If they are not clean from pcbnew, then I vote to show it same way as pcbnew.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

If this issue is indeed caused by a third party tool, the question is do we want to be in the business of fixing file format defects created by third party tools? In the past, we have kick the issues back to the tool that generated the bad file format rather than try to fix them within KiCad.

Revision history for this message
Seth Hillbrand (sethh) wrote :

@Wayne- The issue would be breaking compatibility with files 5.0 has accepted up until now.

While OPL (https://www.seeedstudio.com/opl.html) lists its KiCad as alpha, they've undoubtedly worked into more than a few designs already that we would break if we enforced a width>0 requirement that refused to open the files.

I'll reach out to Seeed to update their libraries but I think since we didn't catch the discrepancy before release, we should keep the option and just update the width to either a minimum value or a default value.

Revision history for this message
TD-Linux (bztdlinux) wrote :

I also hit this, but with SnapEDA generated parts (I think, I haven't gone through them one by one to determine what causes the crash).

I also prefer #1, but really anything that doesn't crash is OK :)

Revision history for this message
Fabián Inostroza (fabianinostroza) wrote :

I have a board that generates the same segfault when the board contains a footprint generated using bitmap2component. I've attached the footprint.

The logo was bigger and I removed the polygons in a text editor leaving only one. Launching the 3d viewer from the footprint editor crash kicad and generates the same segfault.

Revision history for this message
Fabián Inostroza (fabianinostroza) wrote :

Generating a footprint from footprint editor and adding a polygon also makes kicad crash.

Application: kicad
Version: (6.0.0-rc1-dev-459-gf85b1479a), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 GnuTLS/3.5.19 zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) libssh2/1.8.0 nghttp2/1.32.0 librtmp/2.3
Platform: Linux 4.17.0-3-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.0
    Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=OFF

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 73c2297144fb14ef28ab7811cc0d3523e735336a
https://git.launchpad.net/kicad/patch/?id=73c2297144fb14ef28ab7811cc0d3523e735336a

Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Seth Hillbrand (sethh) wrote :

I pushed a patch for the issue Fabian reports. This was different from the first issue.

The original issue still remains. Currently, gerber output will replace the zero-width lines with the value of "Default Line Width" in the plot dialog box. I suggest that we replace the zero width lines with the default values from include/board_design_settings.h. This gets us to WYSIWYG for layout/3d/gerber.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Re-opening for the second issue (line width) in this report.

Changed in kicad:
importance: High → Medium
status: Fix Committed → Confirmed
Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1790534] Re: 3D viewer crashes KiCAD when opened

@Seth, using the default line width for zero width line makes the most
sense to me. I can't think of a better option. I would not set the
board status as modified. Just make this the default. If the user
makes any changes to the board, zero line width will get overwritten.

On 9/5/2018 6:24 PM, Seth Hillbrand wrote:
> I pushed a patch for the issue Fabian reports. This was different from
> the first issue.
>
> The original issue still remains. Currently, gerber output will replace
> the zero-width lines with the value of "Default Line Width" in the plot
> dialog box. I suggest that we replace the zero width lines with the
> default values from include/board_design_settings.h. This gets us to
> WYSIWYG for layout/3d/gerber.
>

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 1100ccb0326c3d781511d3e6e21a5a6351f80cc2
https://git.launchpad.net/kicad/patch/?id=1100ccb0326c3d781511d3e6e21a5a6351f80cc2

Changed in kicad:
status: Confirmed → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.