Segfault during ElmerGUI mesh open

Clearly defined bug reports and their fixes
Post Reply
DHal
Posts: 3
Joined: 31 May 2011, 17:49
Antispam: Yes

Segfault during ElmerGUI mesh open

Post by DHal »

Dear Elmer Developers,


I am currently experiencing a crash when loading a particular mesh under ElmerGUI (7.0.svn.6035). I have attached a zip file with the mesh involved. It is possible there is a topological problem with the mesh, though I don't think there should be.

GDB indicates that there is something wrong with the surface_t object in use at src/meshUtils.cpp:1025 . Looking at the code, it appears that some form of inverse map for the mesh is being constructed and is failing.

The value of k (which I think should be the surface index) is suspicious, as (assuming I am reading this correctly) I don't have that many surface nodes:

Code: Select all

Loading elmer mesh files
Summary:
Nodes: 4292
Point elements: 64
Edge elements: 1424
Surface elements: 7392
Volume elements: 10448
Found 11088 edges on boundary
The original mesh was generated using gmsh, and saved as .msh format. I used ElmerGrid to convert this to elmer format, which is the attached file

Code: Select all

(gdb) info locals
r = 0
k = 9506
s = 0x7fff41d31088
j = 0
e = 0x7fff41ad8418
i = 16
keys = 4292
hash = 0x1f32c70
triedgemap = {{0, 1, 3, 6}, {1, 2, 4, 7}, {2, 0, 5, 8}}
found = false
h = 0x1f6d718
createindexes = false
quadedgemap = {{0, 1, 4, 8}, {1, 2, 5, 9}, {2, 3, 6, 10}, {3, 0, 7, 11}}
edges = 11088
(gdb)bt
#0  0x0000000000498e18 in surface_t::getEdges (this=0x7fff41d31088) at src/meshtype.cpp:320
#1  0x00000000004a05a5 in Meshutils::findSurfaceElementEdges (this=0x1158c40, mesh=0xebec70) at src/meshutils.cpp:1025
#2  0x000000000046d1af in MainWindow::loadElmerMesh (this=0x7fffffffe110, dirName=...) at src/mainwindow.cpp:1397
#3  0x000000000046cf68 in MainWindow::loadSlot (this=0x7fffffffe110) at src/mainwindow.cpp:1370
#4  0x000000000058c7de in MainWindow::qt_static_metacall (_o=0x7fffffffe110, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffffffd350)
    at tmp/moc_mainwindow.cpp:240
#5  0x00007ffff00aa77a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
<snip>

Valgrind indicates a similar error, but doesn't really add that much info on the problem itself.

Code: Select all

==21112== Invalid read of size 4
==21112==    at 0x498E18: surface_t::getEdges() const (meshtype.cpp:320)
==21112==    by 0x4A05A4: Meshutils::findSurfaceElementEdges(mesh_t*) (meshutils.cpp:1025)
==21112==    by 0x46D1AE: MainWindow::loadElmerMesh(QString) (mainwindow.cpp:1397)
==21112==    by 0x46CF67: MainWindow::loadSlot() (mainwindow.cpp:1370)
==21112==    by 0x58C7DD: MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_mainwindow.cpp:240)
==21112==    by 0xC9A2779: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==21112==    by 0xBD29571: QAction::triggered(bool) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD2AF42: QAction::activate(QAction::ActionEvent) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC1552F8: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC159828: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD7EC99: QWidget::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC15D62A: QMenu::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==  Address 0xc94460d8 is not stack'd, malloc'd or (recently) free'd
==21112== 
==21112== Invalid read of size 8
==21112==    at 0x498E57: surface_t::getEdgeIndex(int) const (meshtype.cpp:330)
==21112==    by 0x4A056E: Meshutils::findSurfaceElementEdges(mesh_t*) (meshutils.cpp:1026)
==21112==    by 0x46D1AE: MainWindow::loadElmerMesh(QString) (mainwindow.cpp:1397)
==21112==    by 0x46CF67: MainWindow::loadSlot() (mainwindow.cpp:1370)
==21112==    by 0x58C7DD: MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_mainwindow.cpp:240)
==21112==    by 0xC9A2779: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==21112==    by 0xBD29571: QAction::triggered(bool) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD2AF42: QAction::activate(QAction::ActionEvent) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC1552F8: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC159828: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD7EC99: QWidget::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC15D62A: QMenu::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==  Address 0xc94460e0 is not stack'd, malloc'd or (recently) free'd
==21112== 
==21112== Invalid read of size 4
==21112==    at 0x498E68: surface_t::getEdgeIndex(int) const (meshtype.cpp:330)
==21112==    by 0x4A056E: Meshutils::findSurfaceElementEdges(mesh_t*) (meshutils.cpp:1026)
==21112==    by 0x46D1AE: MainWindow::loadElmerMesh(QString) (mainwindow.cpp:1397)
==21112==    by 0x46CF67: MainWindow::loadSlot() (mainwindow.cpp:1370)
==21112==    by 0x58C7DD: MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_mainwindow.cpp:240)
==21112==    by 0xC9A2779: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==21112==    by 0xBD29571: QAction::triggered(bool) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD2AF42: QAction::activate(QAction::ActionEvent) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC1552F8: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC159828: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD7EC99: QWidget::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC15D62A: QMenu::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==  Address 0x50 is not stack'd, malloc'd or (recently) free'd
==21112== 
==21112== 
==21112== Process terminating with default action of signal 11 (SIGSEGV)
==21112==  Access not within mapped region at address 0x50
==21112==    at 0x498E68: surface_t::getEdgeIndex(int) const (meshtype.cpp:330)
==21112==    by 0x4A056E: Meshutils::findSurfaceElementEdges(mesh_t*) (meshutils.cpp:1026)
==21112==    by 0x46D1AE: MainWindow::loadElmerMesh(QString) (mainwindow.cpp:1397)
==21112==    by 0x46CF67: MainWindow::loadSlot() (mainwindow.cpp:1370)
==21112==    by 0x58C7DD: MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_mainwindow.cpp:240)
==21112==    by 0xC9A2779: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.6)
==21112==    by 0xBD29571: QAction::triggered(bool) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD2AF42: QAction::activate(QAction::ActionEvent) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC1552F8: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC159828: ??? (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xBD7EC99: QWidget::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
==21112==    by 0xC15D62A: QMenu::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.6)
Attachments
mesh.tar.gz
Mesh that causes segfault
(243.74 KiB) Downloaded 380 times
DHal
Posts: 3
Joined: 31 May 2011, 17:49
Antispam: Yes

Re: Segfault during ElmerGUI mesh open

Post by DHal »

I've worked out part of the problem. The GMSH mesh is not being fully generated correctly - some volume nodes were missing. Stripping unused elements with -autoclean as per this thread works-around the problem.

Can ElmerGUI check for sufficient mesh sanity and abort with an error?
Post Reply