Bug#913715: simulide: terminates with segfault sometimes, when trying to undo changes

2018-12-16 Thread Bernhard Übelacker
Hello Nils Jarle Haugen,
these instructions are great to reproduce the crash.

Below is the backtrace with debug symbols installed.
It looks like the vector m_boardLed->m_pin contains invalid
data, and therefore we crash when calling methods on an
element retrieved from it.

Valgrind shows the same backtrace, while the accessed element
got free'd before.

This should probably be forwarded to upstream developers.
Upstream commit [1] might be related, but does not apply
cleanly to 0.1.7+dfsg-2.

Kind regards,
Bernhard



[1] https://sourceforge.net/p/simulide/svnrepo/434/




Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x5588dcda66e5 in Arduino::initialize (this=0x5588de934280) at 
../src/gui/circuitwidget/components/mcu/arduino.cpp:173
173 m_boardLed->getEpin(0)->setEnode(enod);
[Current thread is 1 (Thread 0x7f4e80ab3f80 (LWP 12035))]
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/simulide/orig/simulide-0.1.7+dfsg/src
Source directories searched: 
/home/benutzer/simulide/orig/simulide-0.1.7+dfsg/src:$cdir:$cwd
(gdb) bt
#0  0x5588dcda66e5 in Arduino::initialize (this=0x5588de934280) at 
../src/gui/circuitwidget/components/mcu/arduino.cpp:173
#1  0x5588dcdfee62 in Simulator::runContinuous (this=0x5588de808c30) at 
../src/simulator/simulator.cpp:176
#2  0x5588dcd321bf in Circuit::undo (this=this@entry=0x5588de808ba0) at 
../src/gui/circuitwidget/circuit.cpp:602
#3  0x5588dcd36230 in Circuit::keyPressEvent (this=0x5588de808ba0, 
event=0x7ffc53072c50) at ../src/gui/circuitwidget/circuit.cpp:999
#4  0x7f4e8912a567 in QGraphicsScene::event (this=0x5588de808ba0, 
event=0x7ffc53072c50) at graphicsview/qgraphicsscene.cpp:3387
#5  0x7f4e88e1a491 in QApplicationPrivate::notify_helper 
(this=this@entry=0x5588de7832c0, receiver=receiver@entry=0x5588de808ba0, 
e=e@entry=0x7ffc53072c50) at kernel/qapplication.cpp:3727
#6  0x7f4e88e21ad0 in QApplication::notify (this=0x7ffc53072ea0, 
receiver=0x5588de808ba0, e=0x7ffc53072c50) at kernel/qapplication.cpp:3486
#7  0x7f4e8832d039 in QCoreApplication::notifyInternal2 
(receiver=0x5588de808ba0, event=event@entry=0x7ffc53072c50) at 
../../include/QtCore/5.11.2/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:307
#8  0x7f4e89146f87 in QCoreApplication::sendEvent (event=0x7ffc53072c50, 
receiver=) at 
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234
#9  QGraphicsView::keyPressEvent (this=0x5588de85a9e0, event=0x7ffc53072c50) at 
graphicsview/qgraphicsview.cpp:3161
#10 0x7f4e88e58de7 in QWidget::event (this=this@entry=0x5588de85a9e0, 
event=event@entry=0x7ffc53072c50) at kernel/qwidget.cpp:8940
#11 0x7f4e88efbdee in QFrame::event (this=this@entry=0x5588de85a9e0, 
e=e@entry=0x7ffc53072c50) at widgets/qframe.cpp:550
#12 0x7f4e88efea04 in QAbstractScrollArea::event (this=0x5588de85a9e0, 
e=0x7ffc53072c50) at widgets/qabstractscrollarea.cpp:1168
#13 0x7f4e88e1a491 in QApplicationPrivate::notify_helper 
(this=this@entry=0x5588de7832c0, receiver=receiver@entry=0x5588de85a9e0, 
e=e@entry=0x7ffc53072c50) at kernel/qapplication.cpp:3727
#14 0x7f4e88e22a59 in QApplication::notify (this=, 
receiver=0x5588de85a9e0, e=0x7ffc53072c50) at kernel/qapplication.cpp:3121
#15 0x7f4e8832d039 in QCoreApplication::notifyInternal2 
(receiver=0x5588de85a9e0, event=0x7ffc53072c50) at 
../../include/QtCore/5.11.2/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:307
#16 0x7f4e88e75e79 in QWidgetWindow::event (event=0x7ffc53072c50, 
this=0x5588de92ce80) at kernel/qwidgetwindow.cpp:274
#17 QWidgetWindow::event (this=0x5588de92ce80, event=0x7ffc53072c50) at 
kernel/qwidgetwindow.cpp:224
#18 0x7f4e88e1a491 in QApplicationPrivate::notify_helper 
(this=this@entry=0x5588de7832c0, receiver=receiver@entry=0x5588de92ce80, 
e=e@entry=0x7ffc53072c50) at kernel/qapplication.cpp:3727
#19 0x7f4e88e21ad0 in QApplication::notify (this=0x7ffc53072ea0, 
receiver=0x5588de92ce80, e=0x7ffc53072c50) at kernel/qapplication.cpp:3486
#20 0x7f4e8832d039 in QCoreApplication::notifyInternal2 
(receiver=receiver@entry=0x5588de92ce80, event=event@entry=0x7ffc53072c50) at 
../../include/QtCore/5.11.2/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:307
#21 0x7f4e8872e388 in QCoreApplication::sendSpontaneousEvent 
(event=0x7ffc53072c50, receiver=0x5588de92ce80) at 
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:237
#22 QGuiApplicationPrivate::processKeyEvent (e=0x7f4e78028cb0) at 
kernel/qguiapplication.cpp:2207
#23 0x7f4e88733a05 in QGuiApplicationPrivate::processWindowSystemEvent 
(e=e@entry=0x7f4e78028cb0) at kernel/qguiapplication.cpp:1822
#24 0x7f4e8870dd8b in QWindowSystemInterface::sendWindowSystemEvents 
(flags=...) at kernel/qwindowsysteminterface.cpp:1032
#25 0x7f4e80a0585b in QPAEventDispatcherGlib::processEvents 
(this=0x5588de775ef0, flags=...) at qeventdispatcher_glib.cpp:70
#26 0x7f4e8832bd0b in 

Bug#913715: Bug #913715: simulide: terminates with segfault sometimes, when trying to undo changes

2018-11-23 Thread Nils Jarle Haugen

Hello,

Thanks you very much for the suggestions!

I tried running the program with again with gdb and got a backtrace of 
the crash.
Below is output of all threads(thread apply all bt). A more 
comprehensive output (thread apply all bt full) is available at: 
https://paste.debian.net/?show=1053004


What I did:

1. Added Arduino AVR Board
2. Connected components LED, resistor and ground to pin 4 on the 
Arduino. 5V rail and ground is also directly connect to the board

3. Loaded firmware
4. Started simulation
5. Stopped simulation
6. Started simulation
7. Moved components 5V rail and ground.
8. Used [Ctrl+Z] to undo the move
9. Program Segfaults

Hope this information is helpful.

Kind regards,
Nils Jarle Haugen


AvrProcessor::loadFirmware Avr Init:  atmega328 true
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 12494, 
resource id: 29360513, major code: 40 (TranslateCoords), minor code: 0

[Thread 0x7fffd7fff700 (LWP 17080) exited]

Thread 1 "simulide" received signal SIGSEGV, Segmentation fault.
0x555d209a in ?? ()
(gdb) thread apply all bt
Thread 5 (Thread 0x7fffddbf4700 (LWP 12443)):
#0  0x764c5e6c in futex_wait_cancelable (private=out>, expected=0, futex_word=0x55c81520)

    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x764c5e6c in __pthread_cond_wait_common (abstime=0x0, 
mutex=0x55c814d0, cond=0x55c814f8)

    at pthread_cond_wait.c:502
#2  0x764c5e6c in __pthread_cond_wait (cond=0x55c814f8, 
mutex=0x55c814d0) at pthread_cond_wait.c:655

#3  0x7fffde2b0e2b in  () at /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#4  0x7fffde2b0b57 in  () at /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#5  0x764bff2a in start_thread (arg=0x7fffddbf4700) at 
pthread_create.c:463
#6  0x760bfedf in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 4 (Thread 0x7fffdf8f2700 (LWP 12442)):
#0  0x764c5e6c in futex_wait_cancelable (private=out>, expected=0, futex_word=0x55c3ef64)

    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x764c5e6c in __pthread_cond_wait_common (abstime=0x0, 
mutex=0x55c3ef10, cond=0x55c3ef38)

    at pthread_cond_wait.c:502
#2  0x764c5e6c in __pthread_cond_wait (cond=0x55c3ef38, 
mutex=0x55c3ef10) at pthread_cond_wait.c:655
#3  0x7659c44b in QWaitCondition::wait(QMutex*, unsigned long) 
() at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x77443c05 in  () at 
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5

#5  0x7659bc97 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x764bff2a in start_thread (arg=0x7fffdf8f2700) at 
pthread_create.c:463
#7  0x760bfedf in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 3 (Thread 0x7fffe67fb700 (LWP 12441)):
#0  0x760b5739 in __GI___poll (fds=0x7fffe00195c0, nfds=4, 
timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x75100e46 in  () at 
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x75100f6c in g_main_context_iteration () at 
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x76795d13 in 
QEventDispatcherGlib::processEvents(QFlags) 
()

    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x76742d0b in 
QEventLoop::exec(QFlags) ()

    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x765920c6 in QThread::exec() () at 
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5

#6  0x7fffedfb0545 in  () at /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x7659bc97 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x764bff2a in start_thread (arg=0x7fffe67fb700) at 
pthread_create.c:463
#9  0x760bfedf in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 2 (Thread 0x7fffed52e700 (LWP 12440)):
#0  0x760b5739 in __GI___poll (fds=0x7fffed52d9f8, nfds=1, 
timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29

#1  0x72f82cf7 in  () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x72f8491a in xcb_wait_for_event () at 
/usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x7fffee073519 in  () at 
/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5

#4  0x7659bc97 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x764bff2a in start_thread (arg=0x7fffed52e700) at 
pthread_create.c:463
#6  0x760bfedf in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Thread 1 (Thread 0x7fffee565f80 (LWP 12435)):
#0  0x555d209a in  ()
#1  0x555d5c1e in  ()
#2  0x555d7397 in  ()
#3  0x555d08bc in  ()
#4  0x5563eae6 in  ()
#5  0x556379ff in  ()
#6  0x555bbf30 in  ()
#7  0x555bd7bd in  ()
#8  0x555c0f9e in  ()
#9  0x555c5230 in  ()
#10 0x77541567 in QGraphicsScene::event(QEvent*) () at 
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x77231491 in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) ()

    at 

Bug#913715: Bug #913715: simulide: terminates with segfault sometimes, when trying to undo changes

2018-11-18 Thread Bernhard Übelacker
Hello Nils Jarle Haugen,
I just tried to reproduce the issue.

Unfortunately without having deeper knowledge about
simulide and not knowing which elements you are using,
I did not receive a crash.

Running with valgrind led just to an unintialized variable
m_deltaV that might be more related to the elements I used,
and that I guess should not be able to cause a crash.

Also there seems to be a problem with your upload to
paste.debian.net.

Therefore and because its happens just randomly, you might
have a look at [1], which contains informations to install
some debug information and let simulide run inside a debugger.
Without the output of the bt command inside gdb chances
are very low to find what is causing this.

[1] https://wiki.debian.org/HowToGetABacktrace

Kind regards,
Bernhard



Bug#913715: simulide: terminates with segfault sometimes, when trying to undo changes

2018-11-14 Thread Nils Jarle Haugen

Package: simulide
Version: 0.1.7+dfsg-2
Severity: normal

Dear Maintainer,

Sometimes when I try to undo changes (by pressing Ctrl+Z) the program 
terminates with

segfault. This happens not often, but is frustrating because all the
changes done to the circuit is lost since last save.

To prevent this from happening I now avoid to use the
undo-functionality of the program, and it runs very stable.


   * What led up to the situation?
     Using the program as normal, moving a component in the circuit 
into another position

   * What exactly did you do (or not do) that was effective (or
 ineffective)?
    Pressed Ctrl+Z to undo the change I did.
   * What was the outcome of this action ( does not happen all the time).
    Program exited with segfault.
   * What outcome did you expect instead?
    Undo the change I did with the component in the ciruit.

Please see this paste from /var/log/messages with the segfault: 
http://paste.debian.net/1051656/




Best regards,
Nils J. Haugen

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=nn_NO.UTF-8, LC_CTYPE=nn_NO.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US (charmap=UTF-8)

Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages simulide depends on:
ii  gpsim  0.30.0-1
ii  libc6  2.27-8
ii  libelf1    0.170-0.5
ii  libgcc1    1:8.2.0-9
ii  libqt5core5a   5.11.2+dfsg-4
ii  libqt5gui5 5.11.2+dfsg-4
ii  libqt5multimedia5  5.11.2-2
ii  libqt5serialport5  5.11.2-2
ii  libqt5svg5 5.11.2-2
ii  libqt5widgets5 5.11.2+dfsg-4
ii  libqt5xml5 5.11.2+dfsg-4
ii  libstdc++6 8.2.0-9

Versions of packages simulide recommends:
ii  arduino-core   2:1.0.5+dfsg2-4.1
ii  avra   1.3.0-3
ii  gputils    1.4.0-0.1+b1
ii  libqt5multimedia5-plugins  5.11.2-2

Versions of packages simulide suggests:
ii  arduino   2:1.0.5+dfsg2-4.1
ii  avr-libc  1:2.0.0+Atmel3.6.1-1
ii  gcc-avr   1:5.4.0+Atmel3.6.0-1+b1
pn  simavr    
pn  simutron  

-- no debconf information