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

segfault opening molecule xyz file from command line #1617

Closed
drew-parsons opened this issue Feb 12, 2024 · 6 comments · Fixed by #1621
Closed

segfault opening molecule xyz file from command line #1617

drew-parsons opened this issue Feb 12, 2024 · 6 comments · Fixed by #1621

Comments

@drew-parsons
Copy link
Contributor

Avogadro version:

  • Avogadrolibs: 1.99.0
    (but About reports "Avogadro Library Version: 1.97.0-4-42-gb9da376")
  • Qt: 5.15.10

Desktop version: (please complete the following information):

  • OS: Linux
  • Version debian unstable
  • Compiler gcc 13.2.0

Describe the bug

avogadro 1.99.0 segfaults when opening a file from the command line (I tested xyz files).
For instance a simple methane molecule, methane.xyz

5
XYZ file generated by Avogadro.
C     -1.21766    1.04689    0.00000
H     -0.41766    0.79852    0.66575
H     -0.89506    1.81122   -0.67574
H     -1.50295    0.17754   -0.55475
H     -2.05496    1.40028    0.56475

To Reproduce
Steps to reproduce the behavior:

  1. avogadro methane.xyz
  2. See error

Expected behavior
The molecule file loads without error via the GUI interface (File->Open). It should possible to open from the command line also.

Screenshots

$ LD_LIBRARY_PATH=/projects/avogadrolibs/obj-x86_64-linux-gnu/lib gdb avogadro
GNU gdb (Debian 13.2-1) 13.2
...
Type "apropos word" to search for commands related to "word"...
Reading symbols from avogadro...
Reading symbols from /usr/lib/debug/.build-id/3a/7a9a071a88775b79f7a3f8f73387e1434a3898.debug...
(gdb) run methane.xyz
Starting program: /usr/bin/avogadro methane.xyz
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff06b76c0 (LWP 1402631)]
[New Thread 0x7fffeece46c0 (LWP 1402632)]
[New Thread 0x7fffee4e36c0 (LWP 1402633)]
[New Thread 0x7fffedce26c0 (LWP 1402634)]
[New Thread 0x7fffed3c06c0 (LWP 1402635)]
Using locale:  "en_AU"
AvogadroApp Translation  "en_AU"  loaded  "/usr/bin/../share/avogadro2/i18n/"
[New Thread 0x7fffccdff6c0 (LWP 1402637)]
[New Thread 0x7fffc7fff6c0 (LWP 1402638)]
[New Thread 0x7fffc77fe6c0 (LWP 1402639)]
[New Thread 0x7fffc6ffd6c0 (LWP 1402640)]
[Thread 0x7fffc6ffd6c0 (LWP 1402640) exited]
[Thread 0x7fffc77fe6c0 (LWP 1402639) exited]
[New Thread 0x7fffc77fe6c0 (LWP 1402641)]
[New Thread 0x7fffc6ffd6c0 (LWP 1402642)]
Extension plugins dynamically found… 41
[New Thread 0x7fffc67fc6c0 (LWP 1402643)]
OBProcess::executeObabel: Running "obabel" "-L formats read"
[Detaching after fork from child process 1402644]
OBProcess::executeObabel: Running "obabel" "-L formats write"
[Detaching after fork from child process 1402645]
OBProcess::executeObabel: Running "obabel" "-L forcefields"
[Detaching after fork from child process 1402646]
OBProcess::executeObabel: Running "obabel" "-L charges"
[Detaching after fork from child process 1402647]
OBProcess::executeObabel: Running "obabel" "-V"
[Detaching after fork from child process 1402648]
"obabel"  found:  "obabel: Open Babel 3.1.1 -- Jan 10 2024 -- 20:00:50"
"Checking for energy scripts in path /home/.local/share/OpenChemistry/Avogadro/energy"
"Checking for energy scripts in path /usr/share/gnome/OpenChemistry/Avogadro/energy"
"Checking for energy scripts in path /usr/local/share/OpenChemistry/Avogadro/energy"
"Checking for energy scripts in path /usr/share/OpenChemistry/Avogadro/energy"
"Checking for energy scripts in path /var/lib/snapd/desktop/OpenChemistry/Avogadro/energy"
"Checking for energy scripts in path /usr/bin/../lib/x86_64-linux-gnu/avogadro2/scripts/energy"
[Detaching after fork from child process 1402649]
"Cannot load script /usr/lib/x86_64-linux-gnu/avogadro2/scripts/energy/ani2x.py"
[Detaching after fork from child process 1402657]
[Detaching after fork from child process 1402665]
"Cannot load script /usr/lib/x86_64-linux-gnu/avogadro2/scripts/energy/gfn1.py"
[Detaching after fork from child process 1402673]
"Cannot load script /usr/lib/x86_64-linux-gnu/avogadro2/scripts/energy/gfn2.py"
[Detaching after fork from child process 1402681]
"Cannot load script /usr/lib/x86_64-linux-gnu/avogadro2/scripts/energy/gfnff.py"
[Detaching after fork from child process 1402689]
[Detaching after fork from child process 1402697]
[Detaching after fork from child process 1402705]
[Detaching after fork from child process 1402713]
[Detaching after fork from child process 1402721]
 register  GAFF
[Detaching after fork from child process 1402729]
 register  MMFF94
[Detaching after fork from child process 1402737]
 register  UFF
[Detaching after fork from child process 1402745]
 registering obmm plugins
"Checking for commands scripts in path /home/.local/share/OpenChemistry/Avogadro/commands"
"Checking for commands scripts in path /usr/share/gnome/OpenChemistry/Avogadro/commands"
"Checking for commands scripts in path /usr/local/share/OpenChemistry/Avogadro/commands"
"Checking for commands scripts in path /usr/share/OpenChemistry/Avogadro/commands"
"Checking for commands scripts in path /var/lib/snapd/desktop/OpenChemistry/Avogadro/commands"
"Checking for commands scripts in path /usr/bin/../lib/x86_64-linux-gnu/avogadro2/scripts/commands"
"Checking for inputGenerators scripts in path /home/.local/share/OpenChemistry/Avogadro/inputGenerators"
"Checking for inputGenerators scripts in path /usr/share/gnome/OpenChemistry/Avogadro/inputGenerators"
"Checking for inputGenerators scripts in path /usr/local/share/OpenChemistry/Avogadro/inputGenerators"
"Checking for inputGenerators scripts in path /usr/share/OpenChemistry/Avogadro/inputGenerators"
"Checking for inputGenerators scripts in path /var/lib/snapd/desktop/OpenChemistry/Avogadro/inputGenerators"
"Checking for inputGenerators scripts in path /usr/bin/../lib/x86_64-linux-gnu/avogadro2/scripts/inputGenerators"
"Checking for charges scripts in path /home/.local/share/OpenChemistry/Avogadro/charges"
"Checking for charges scripts in path /usr/share/gnome/OpenChemistry/Avogadro/charges"
"Checking for charges scripts in path /usr/local/share/OpenChemistry/Avogadro/charges"
"Checking for charges scripts in path /usr/share/OpenChemistry/Avogadro/charges"
"Checking for charges scripts in path /var/lib/snapd/desktop/OpenChemistry/Avogadro/charges"
"Checking for charges scripts in path /usr/bin/../lib/x86_64-linux-gnu/avogadro2/scripts/charges"
[Detaching after fork from child process 1402753]
"Cannot load script /usr/lib/x86_64-linux-gnu/avogadro2/scripts/charges/antechamber.py"
[Detaching after fork from child process 1402754]
"Cannot load script /usr/lib/x86_64-linux-gnu/avogadro2/scripts/charges/xtb.py"
"Checking for formatScripts scripts in path /home/.local/share/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /usr/share/gnome/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /usr/local/share/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /usr/share/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /var/lib/snapd/desktop/OpenChemistry/Avogadro/formatScripts"
"Checking for formatScripts scripts in path /usr/bin/../lib/x86_64-linux-gnu/avogadro2/scripts/formatScripts"
[Detaching after fork from child process 1402755]
[Detaching after fork from child process 1402756]
[Detaching after fork from child process 1402757]
[New Thread 0x7fffc5ffb6c0 (LWP 1402758)]
[New Thread 0x7fffc57fa6c0 (LWP 1402759)]
[New Thread 0x7fffc4ff96c0 (LWP 1402760)]

Thread 1 "avogadro" received signal SIGSEGV, Segmentation fault.
Avogadro::Core::Layer::activeLayer (this=this@entry=0xb8) at ./avogadro/core/layer.cpp:82
82	./avogadro/core/layer.cpp: No such file or directory.
(gdb) bt
#0  Avogadro::Core::Layer::activeLayer() const (this=this@entry=0xb8) at ./avogadro/core/layer.cpp:82
#1  0x00007ffff7e40691 in Avogadro::QtGui::PluginLayerManager::getSetting<Avogadro::QtPlugins::LayerWireframe>(unsigned long) (this=this@entry=0x555555b8c390, layer=layer@entry=18446744073709551615) at ./avogadro/qtgui/pluginlayermanager.h:86
#2  0x00007ffff7e3cfed in Avogadro::QtPlugins::Wireframe::setupWidget() (this=0x555555b8c380) at ./avogadro/qtplugins/wireframe/wireframe.cpp:183
#3  0x00007ffff7b58dd8 in Avogadro::QtGui::ScenePluginModel::data(QModelIndex const&, int) const (this=<optimized out>, index_=..., role=0) at ./avogadro/qtgui/scenepluginmodel.cpp:89
#4  0x00007ffff7605fc0 in QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#5  0x00007ffff7605638 in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6  0x00007ffff764b8f3 in QTreeView::indexRowSizeHint(QModelIndex const&) const () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007ffff764f274 in QTreeViewPrivate::itemHeight(int) const () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff765082d in QTreeViewPrivate::updateScrollBars() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff765a7b2 in QTreeView::updateGeometries() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff73a63aa in QWidget::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff7452022 in QFrame::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff62cc4b3 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff7362f22 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff62cc748 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff739de36 in QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff73a2897 in QWidgetPrivate::show_helper() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff73a5873 in QWidgetPrivate::setVisible(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff73a2819 in QWidgetPrivate::showChildren(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff73a28b3 in QWidgetPrivate::show_helper() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007ffff73a2839 in QWidgetPrivate::showChildren(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff73a28b3 in QWidgetPrivate::show_helper() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff73a5873 in QWidgetPrivate::setVisible(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff73a2819 in QWidgetPrivate::showChildren(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff73a28b3 in QWidgetPrivate::show_helper() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff73a5873 in QWidgetPrivate::setVisible(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x0000555555570561 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at ./avogadro/avogadro.cpp:316

Additional context
Add any other context about the problem here. Please consider uploading or linking test files.

@ghutchis
Copy link
Member

Weird. That line (layer.cpp:82) only returns a pointer. Even if the pointer were invalid, it seems like it would just return nullptr and something else might crash.

My guess is that it's trying to get some information from the layers which don't exist yet. But it opens fine from the command-line for me.

I'll look into it.

@avo-bot
Copy link

avo-bot commented Feb 15, 2024

This issue has been mentioned on Avogadro Discussion. There might be relevant details there:

https://discuss.avogadro.cc/t/1-99-segfaults-when-opening-a-file-via-the-command-line/5280/2

ghutchis added a commit to ghutchis/avogadrolibs that referenced this issue Feb 16, 2024
App would query if render plugins had options too early
Added separate method (vs. checking for nullptr)

Fix OpenChemistry#1617

Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
Copy link
Contributor

Here are the build results
Avogadro2.AppImage
macOS.dmg
Artifacts will only be retained for 90 days.

Copy link
Contributor

Here are the build results
Avogadro2.AppImage
macOS.dmg
Win64.exe
Artifacts will only be retained for 90 days.

@ghutchis
Copy link
Member

@drew-parsons - I will probably make a 1.99.1 release soon .. but feel free to grab these as patches to the Debian packages.

Copy link
Contributor

Here are the build results
Avogadro2.AppImage
Artifacts will only be retained for 90 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants