Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

0.5.16-RC3 : segfault (core dumped)

4 posters

Go down  Message [Page 1 of 1]

10.5.16-RC3 : segfault (core dumped) Empty 0.5.16-RC3 : segfault (core dumped) Mon Apr 12, 2021 5:38 pm

SuperUserNameMan



Hello,

I compiled version 0.5.16-RC3 on Linux 64bits.

But when I execute ./simulide into the terminal I get this error :
Code:
Segmentation fault (core dumped)


Edit : i got the code from "bzr branch lp:simulide". It is revision 222 from 2021-04-10 17:36:26

20.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Mon Apr 12, 2021 6:20 pm

arcachofo

arcachofo

Thanks, I will have a look.

Anyway, until yesterday I was 100% focused in getting 0.4.15-SR1 ready.
Right now I have no idea of the state of 0.5.16.

Now I'm starting to work on 0.5.16 again.

30.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Mon Apr 12, 2021 9:43 pm

nulik



SuperUserNameMan wrote:Hello,

I compiled version 0.5.16-RC3 on Linux 64bits.

But when I execute ./simulide into the terminal I get this error :
Code:
Segmentation fault (core dumped)


Edit : i got the code from "bzr branch lp:simulide". It is revision 222 from 2021-04-10 17:36:26

run it through the GDB debugger and send us the backtrace (type 'bt' when you see the crash), because this kind of report is useless without backtrace

40.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Tue Apr 13, 2021 10:53 am

SuperUserNameMan



nulik wrote:run it through the GDB debugger and send us the backtrace (type 'bt' when you see the crash), because this kind of report is useless without backtrace

Code:

Reading symbols from simulide...
(No debugging symbols found in simulide)
(gdb) r
Starting program: /home/XXX/XXX/simulide/build_XX/executables/SimulIDE_0.5.16-RC3/bin/simulide
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff2172700 (LWP 8344)]

Thread 1 "simulide" received signal SIGSEGV, Segmentation fault.
0x00007ffff6a9d6de in QString::append(QString const&) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
(gdb) bt
#0  0x00007ffff6a9d6de in QString::append(QString const&) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#1  0x0000000000488a5e in OutPanelText::writeText(QString) ()
#2  0x00000000004a6db1 in CircuitWidget::simDebug(QString) ()
#3  0x000000000047f34b in myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) ()
#4  0x00007ffff6a131f8 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff6a14851 in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff6b09840 in QDebug::~QDebug() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff191cbe0 in Qt5CTPlatformTheme::Qt5CTPlatformTheme() ()
   from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
#8  0x00007ffff1918c59 in Qt5CTPlatformThemePlugin::create(QString const&, QStringList const&) ()
   from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
#9  0x00007ffff72c5868 in QPlatformThemeFactory::create(QString const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007ffff72cf200 in QGuiApplicationPrivate::createPlatformIntegration()
    () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#11 0x00007ffff72d0708 in QGuiApplicationPrivate::createEventDispatcher() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007ffff6bea085 in QCoreApplicationPrivate::init() ()
#13 0x00007ffff72d2543 in QGuiApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007ffff7a243bd in QApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x000000000047b454 in main ()

50.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Tue Apr 13, 2021 11:04 am

Aejwt



Try removing this line in main.cpp (line 82) :
qInstallMessageHandler( myMessageOutput );

Weirdly, it sometimes works even if I do not remove that line. However, when I remove it, program always loads normally.

https://meteorolojiverileri.wordpress.com

60.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Tue Apr 13, 2021 7:45 pm

nulik



Aejwt wrote:Try removing this line in main.cpp (line 82) :
qInstallMessageHandler( myMessageOutput );

Weirdly, it sometimes works even if I do not remove that line. However, when I remove it, program always loads normally.

my best guess is that Simulator object doesn't have enough time to initialize, so if you change this line in outpaneltext.cpp , the writeText() function:

Code:
if( !Simulator::self()->isRunning() ) updateStep();

for this
Code:

    if (Simulator::self()) {
        if( !Simulator::self()->isRunning() ) updateStep();
    }

it might work

Aejwt likes this post

70.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Tue Apr 13, 2021 8:27 pm

arcachofo

arcachofo

my best guess is that Simulator object doesn't have enough time to initialize, so if you change this line in outpaneltext.cpp , the writeText() function:
Good catch.

But I would say the problem is more in CircuitWidget::simDebug( QString msg )
No?

80.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Tue Apr 13, 2021 11:47 pm

nulik



arcachofo wrote:
my best guess is that Simulator object doesn't have enough time to initialize, so if you change this line in outpaneltext.cpp , the writeText() function:
Good catch.

But I would say the problem is more in CircuitWidget::simDebug( QString msg )
No?

ohh, yeah, there too. in two places.

90.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Thu Apr 15, 2021 3:24 pm

SuperUserNameMan



Here is a new backtrace with revision 227.

On line #1, this time, it is in ::appendLine(). ( previous backtrace, it was in ::writeText() )

Code:

#0  0x00007ffff6a9d6de in QString::append(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#1  0x0000000000488b2e in OutPanelText::appendLine(QString) ()
#2  0x00000000004a46ee in CircuitWidget::simDebug(QString) ()
#3  0x000000000047f41b in myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) ()
#4  0x00007ffff6a131f8 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff6a14851 in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff6b09840 in QDebug::~QDebug() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff191cbe0 in Qt5CTPlatformTheme::Qt5CTPlatformTheme() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
#8  0x00007ffff1918c59 in Qt5CTPlatformThemePlugin::create(QString const&, QStringList const&) () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
#9  0x00007ffff72c5868 in QPlatformThemeFactory::create(QString const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007ffff72cf200 in QGuiApplicationPrivate::createPlatformIntegration() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#11 0x00007ffff72d0708 in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007ffff6bea085 in QCoreApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff72d2543 in QGuiApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007ffff7a243bd in QApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x000000000047b504 in main ()

100.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Thu Apr 15, 2021 5:03 pm

nulik



nulik wrote:
arcachofo wrote:
my best guess is that Simulator object doesn't have enough time to initialize, so if you change this line in outpaneltext.cpp , the writeText() function:
Good catch.

But I would say the problem is more in CircuitWidget::simDebug( QString msg )
No?

ohh, yeah, there too. in two places.

it is another problem than I originally thought. What is happening is that when `Circuit` object is called for deleteLater() sometimes in the future, when this future comes (in a new Qt event loop) the new Circuit object has a new Simulator which is a good one. So the deleteLater() call `delete`s a good `Simulator` object. The quick fix for this is to separate `delete`s of the Simulator from the Circuit. Something like this:

Code:
diff -Naur orig-simulide/trunk/src/gui/circuitwidget/circuit.cpp simulide/trunk/src/gui/circuitwidget/circuit.cpp
--- orig-simulide/trunk/src/gui/circuitwidget/circuit.cpp 2021-04-14 11:49:58.000000000 -0500
+++ simulide/trunk/src/gui/circuitwidget/circuit.cpp 2021-04-15 09:54:46.813299073 -0500
@@ -48,7 +48,6 @@
        : QGraphicsScene( x, y, width, height, parent )
 {
     Q_UNUSED( Circuit_properties );
-
     m_simulator = new Simulator();
    
     setObjectName( "Circuit" );
@@ -80,8 +79,6 @@
 
 Circuit::~Circuit()
 {
-    delete m_simulator;
-
     m_bckpTimer.stop();
 
     // Clear Undo/Redo stacks
@@ -97,6 +94,9 @@
         QFile::remove( m_backupPath ); // Remove backup file
     }
 }
+void Circuit::deleteSimulatorLater() {
+    this->m_simulator->deleteLater();
+}
 
 Component* Circuit::getComponent( QString name )
 {
diff -Naur orig-simulide/trunk/src/gui/circuitwidget/circuit.h simulide/trunk/src/gui/circuitwidget/circuit.h
--- orig-simulide/trunk/src/gui/circuitwidget/circuit.h 2021-04-14 11:49:58.000000000 -0500
+++ simulide/trunk/src/gui/circuitwidget/circuit.h 2021-04-15 09:22:28.172433900 -0500
@@ -39,7 +39,7 @@
         ~Circuit();
 
  static Circuit* self() { return m_pSelf; }
-        
+        void deleteSimulatorLater();
         bool drawGrid();
         void setDrawGrid( bool draw );
        
diff -Naur orig-simulide/trunk/src/gui/circuitwidget/circuitview.cpp simulide/trunk/src/gui/circuitwidget/circuitview.cpp
--- orig-simulide/trunk/src/gui/circuitwidget/circuitview.cpp 2021-01-03 07:01:34.000000000 -0600
+++ simulide/trunk/src/gui/circuitwidget/circuitview.cpp 2021-04-15 09:54:20.716534027 -0500
@@ -138,13 +139,14 @@
     if( m_circuit )
     {
         m_circuit->remove();
+        m_circuit->deleteSimulatorLater();
         m_circuit->deleteLater();
     }
     resetMatrix();
diff -Naur orig-simulide/trunk/src/simulator/simulator.cpp simulide/trunk/src/simulator/simulator.cpp
--- orig-simulide/trunk/src/simulator/simulator.cpp 2021-04-14 09:58:34.000000000 -0500
+++ simulide/trunk/src/simulator/simulator.cpp 2021-04-15 09:52:15.592865627 -0500
@@ -60,7 +60,6 @@
 Simulator::~Simulator()
 {
     m_CircuitFuture.waitForFinished();
-    m_pSelf = NULL;
 }
 
 inline void Simulator::solveMatrix()

if the patch above doesn't patch clearly you will have to reproduce the changes by hand one by one, because I had to edit it manually because I have other things in this source files.

110.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Thu Apr 15, 2021 8:29 pm

arcachofo

arcachofo

I'm currently thinking about these issues, all related with the creation of Simulator object.

Creating a Simulator along with each Circuit ensured that everything is clean, but now it is complicating some other things.

Maybe, after last changes it is better to create a single Simulator in the begining and keep it.
Or find an alernate solution for Simulator::self() calls.

I'm thinking in different potential solutions and the pros and cons of each one.
The simplest one looks to be an alernate solution for Simulator::self() calls.

PS:
I will move this thread to "Development" section.

120.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Thu Apr 15, 2021 10:12 pm

nulik



arcachofo wrote:I'm currently thinking about these issues, all related with the creation of Simulator object.

Creating a Simulator along with each Circuit ensured that everything is clean, but now it is complicating some other things.

Maybe, after last changes it is better to create a single Simulator in the begining and keep it.
Or find an alernate solution for Simulator::self() calls.

I'm thinking in different potential solutions and the pros and cons of each one.
The simplest one looks to be an alernate solution for Simulator::self() calls.

PS:
I will move this thread to "Development" section.

from the point of view of the Design, Simulator object should be dependent on the Circuit object because Simulator object can't exist without circuit. So, they must be created and deleted together, imho. So, Simulator::self, should be replaced by Circuit::Simulator() returning Simulator object. and Simulator::self() should be deprecated. Any reference to Simulator should go through Circuit. That's how I would do it.

130.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Fri Apr 16, 2021 9:04 pm

arcachofo

arcachofo

from the point of view of the Design, Simulator object should be dependent on the Circuit object because Simulator object can't exist without circuit. So, they must be created and deleted together, imho.
Yes, that makes sense.

So, Simulator::self, should be replaced by Circuit::Simulator() returning Simulator object. and Simulator::self() should be deprecated. Any reference to Simulator should go through Circuit. That's how I would do it.
In any case calling Circuit::Simulator() is pretty similar to Simulator::self(), because both are created at the same time.
I would call CircuitWidget to ask for Simulator, because this one is created at the begining, last till the end of the program and knows the pointer to the current object.

Anyway I think the crash is solved by now in Rev. 228.

140.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Sat Apr 17, 2021 2:49 pm

SuperUserNameMan



Anyway I think the crash is solved by now in Rev. 228.

Well, according to `bzr log` I'm currently on 228, and I still get a crash :

Code:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff2172700 (LWP 12745)]

Thread 1 "simulide" received signal SIGSEGV, Segmentation fault.
0x00007ffff6a9d6de in QString::append(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
(gdb) bt
#0  0x00007ffff6a9d6de in QString::append(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#1  0x0000000000488b2e in OutPanelText::appendLine(QString) ()
#2  0x00000000004a46ee in CircuitWidget::simDebug(QString) ()
#3  0x000000000047f41b in myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) ()
#4  0x00007ffff6a131f8 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff6a14851 in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff6b09840 in QDebug::~QDebug() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff191cbe0 in Qt5CTPlatformTheme::Qt5CTPlatformTheme() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
#8  0x00007ffff1918c59 in Qt5CTPlatformThemePlugin::create(QString const&, QStringList const&) () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
#9  0x00007ffff72c5868 in QPlatformThemeFactory::create(QString const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007ffff72cf200 in QGuiApplicationPrivate::createPlatformIntegration() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#11 0x00007ffff72d0708 in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007ffff6bea085 in QCoreApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff72d2543 in QGuiApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007ffff7a243bd in QApplicationPrivate::init() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x000000000047b504 in main ()

Maybe I'm not updating the code correctly ?

Here is what I do when I'm inside `./build_XX/`:
Code:

bzr pull
qmake
make -j$(nproc)

cd executables/SimulIDE_0.5.16-RC3/bin

./simulide

150.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Sat Apr 17, 2021 2:54 pm

SuperUserNameMan



It works only if I comment line 33 into `main.cpp` :

Code:

//CircuitWidget::self()->simDebug( msg );

160.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Sat Apr 17, 2021 8:23 pm

arcachofo

arcachofo

Well, according to `bzr log` I'm currently on 228, and I still get a crash :
Unfortunately I can't reproduce this issue.

Can you test this?:  (main.cpp, line 32)

Code:
    case QtDebugMsg:
         if( CircuitWidget::self() )
             CircuitWidget::self()->simDebug( msg );
        
        fprintf( stderr, "%s \n", localMsg.constData() );
        break;

Anyway my plan is to remove this MessageHandler.

SuperUserNameMan likes this post

170.5.16-RC3 : segfault (core dumped) Empty Re: 0.5.16-RC3 : segfault (core dumped) Sun Apr 18, 2021 12:44 pm

SuperUserNameMan



Can you test this?:  (main.cpp, line 32)

It works !

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum