Opened 5 years ago

Closed 5 years ago

#5742 closed defect (fixed)

OMEdit quits abruptly when saving a model

Reported by: Francesco Casella Owned by: Adrian Pop
Priority: blocker Milestone: 1.14.1
Component: OMEdit Version: v1.14.0
Keywords: Cc: Adeel Asghar

Description

While updating the PowerGrids library, it often happens to me that I change some line in the code, and when I hit "Save" OMEdit quits without any error message.

I attach the log files, but I suspect that the problem takes place after the last reported call and there is no related logging. I guess it may be some problem with the NF API, but I'm not sure.

Attachments (1)

OMEdit.zip (515.9 KB ) - added by Francesco Casella 5 years ago.

Download all attachments as: .zip

Change History (18)

by Francesco Casella, 5 years ago

Attachment: OMEdit.zip added

comment:1 by Francesco Casella, 5 years ago

Version: v1.14.0

comment:2 by Francesco Casella, 5 years ago

Even the crash report window is unstable and closes abruptly while typing in the cause of the crash

comment:3 by Adrian Pop, 5 years ago

With help from @casella I could reproduce the crash. The crash happens here:

#0  QHash<QGraphicsItem*, QHashDummyValue>::findNode (this=this@entry=0xfeeefeeefeef00c6, 
    akey=@0xb72b3b8: 0x6a4c8390, ahp=ahp@entry=0x0) at C:/OM114/OMDev/tools/msys/mingw64/include/QtCore/qhash.h:900
#1  0x000000000050c53c in QHash<QGraphicsItem*, QHashDummyValue>::contains (akey=@0xb72b3b8: 0x6a4c8390, 
    this=0xfeeefeeefeef00c6) at C:/OM114/OMDev/tools/msys/mingw64/include/QtCore/qhash.h:875
#2  QSet<QGraphicsItem*>::contains (value=@0xb72b3b8: 0x6a4c8390, this=0xfeeefeeefeef00c6)
    at C:/OM114/OMDev/tools/msys/mingw64/include/QtCore/qset.h:90
#3  GraphicsView::removeItem (this=0xfeeefeeefeeefeee, pGraphicsItem=pGraphicsItem@entry=0x6a4c8390)
    at Modeling/ModelWidgetContainer.cpp:1603
#4  0x00000000005b77ca in Component::handleLoaded (this=0x6a4c8380) at Component/Component.cpp:2429
#5  0x00000000007266e4 in Component::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, 
    _a=<optimized out>) at ../generatedfiles/moc/moc_Component.cpp:328
#6  0x00000000668e3e4a in QMetaObject::activate(QObject*, int, int, void**) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#7  0x000000000051bed9 in ModelWidget::reDrawModelWidget (this=this@entry=0x6a43d310)
    at Modeling/ModelWidgetContainer.cpp:5106
#8  0x0000000000521ccc in ModelWidget::modelicaEditorTextChanged (this=0x6a43d310, pLibraryTreeItem=0xb72ba28)
    at Modeling/ModelWidgetContainer.cpp:5186
#9  0x000000000057b999 in ModelicaEditor::validateText (this=0xedcacb60, 
    pLibraryTreeItem=pLibraryTreeItem@entry=0xb72ba28) at Editors/ModelicaEditor.cpp:400
#10 0x00000000004f84f8 in ModelWidget::validateText (this=<optimized out>, 
    pLibraryTreeItem=pLibraryTreeItem@entry=0xb72ba28) at Modeling/ModelWidgetContainer.cpp:5120
#11 0x00000000004e1363 in LibraryWidget::saveLibraryTreeItem (this=0x5dd10470, pLibraryTreeItem=0xc18702d0)
    at Modeling/LibraryTreeWidget.cpp:4617
#12 0x000000000050f2a5 in ModelWidgetContainer::saveModelWidget (this=<optimized out>)
    at Modeling/ModelWidgetContainer.cpp:7975
#13 0x000000000071f937 in ModelWidgetContainer::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, 
    _id=<optimized out>, _a=<optimized out>) at ../generatedfiles/moc/moc_ModelWidgetContainer.cpp:1284
#14 0x00000000668e3e4a in QMetaObject::activate(QObject*, int, int, void**) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#15 0x00000000154041a6 in QAction::activate(QAction::ActionEvent) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Widgets.dll
#16 0x0000000015404c7a in QAction::event(QEvent*) () from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Widgets.dll
#17 0x000000001540a13c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Widgets.dll
#18 0x000000001540f220 in QApplication::notify(QObject*, QEvent*) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Widgets.dll
#19 0x00000000668c3ca2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#20 0x000000001334bb93 in QShortcutMap::dispatchEvent(QKeyEvent*) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Gui.dll
#21 0x000000001334bcb1 in QShortcutMap::tryShortcut(QKeyEvent*) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Gui.dll
#22 0x00000000133105e7 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Gui.dll
#23 0x0000000013322166 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Gui.dll
#24 0x0000000013327265 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Gui.dll
#25 0x000000001330ca7c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Gui.dll
#26 0x000000006690aa2a in QEventDispatcherWin32Private::sendTimerEvent(int) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#27 0x00007ff8648563ed in USER32!CallWindowProcW () from C:\WINDOWS\System32\user32.dll
#28 0x00007ff864855de2 in USER32!DispatchMessageW () from C:\WINDOWS\System32\user32.dll
#29 0x000000006690a163 in QEventDispatcherWin32::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#30 0x000000006dd30fc5 in qwindows!qt_plugin_instance ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\platforms\qwindows.dll
#31 0x00000000668c2faa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#32 0x00000000668c9c17 in QCoreApplication::exec() () from E:\Program Files\OpenModelica1.14.0-64bit\bin\Qt5Core.dll
#33 0x00000000004018d6 in qMain (argc=193200320, argv=0x23eee080) at main.cpp:182
#34 0x0000000000732f36 in WinMain ()
#35 0x00000000004013ed in __tmainCRTStartup ()
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:334
#36 0x00000000004014fb in WinMainCRTStartup ()
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:184

Now let's see if I can fix it until Adeel comes back :)

comment:4 by Adrian Pop, 5 years ago

I cannot crash 1.16 (master) so it might be that the latest changes by Adeel has fixed this issue.

in reply to:  4 comment:5 by Francesco Casella, 5 years ago

Replying to adrpo:

I cannot crash 1.16 (master) so it might be that the latest changes by Adeel has fixed this issue.

In which case we should definitely backport those changes. We can't afford an unstable 1.14.0 out for a long time.

BTW, I found this reference in the crash report quite strange

this=0xfeeefeeefeeefeee

is it a CS joke or is it real?

comment:6 by Adrian Pop, 5 years ago

No, that's not a joke, it looks like an uninitialized pointer (was deleted).
As far as I can tell, Adeel changed completely the way it handles the part that crashes.

I think we should port all the OMEdit changes (even the changes that Adeel made to be able to do QT testing which are just moving things around but no actual changes in the code) from master to maintenance/1.14 (and maintenance/1.15).

comment:7 by Adeel Asghar, 5 years ago

I already ported all the relevant changes to maintenance/1.14 and maintenance/1.15. We don't need to port testing changes. Do we have a sequence of steps to reproduce this? I am sure this should happen in 1.16 as well.

I have an idea what the problem is but don't really know where it is happening and how could we avoid it. Actually when you change something inside the text view and hit save this causes unloading of all the objects from the view and hence unloading of all the reference objects where they are declared or used. Some of those unloading events are not triggered and hence we end up with objects that are pointing to deleted pointers.

comment:8 by Adrian Pop, 5 years ago

Adeel, I could reproduce it on 1.14 but not on 1.16.
The lib is in the email. To reproduce the bug do:

  1. load PowerGrids
  2. open model: PowerGrids.Examples.IEEE14bus.IEEE14busStaticNetwork
  3. open up PowerGrids.Electrical.BaseClasses.OnePortAC.terminal (or just click on the error in the message browser about the start modifier)
  4. change i(start = port.iStart) to i(re(start = port.iStart.re)) and save
  5. crash

comment:9 by Francesco Casella, 5 years ago

One further comment: @Andrea.Bartolini, who uses OMC under Ubuntu, reported that he had countless crashes with 1.16.0-dev until Linux nightlies stopped being released, from Dec 4th, so he got bored and switched to 1.14.0, which is not crashing for him.

I guess this is just because this kind of bugs depend on how the application is actually compiled into an executable.

I'm not sure if Adeel's changes were merged in before or after Dec 4, if they were merged before that date, we might not have completely solved the problem

comment:10 by Francesco Casella, 5 years ago

@adeas31, thanks for reporting!

comment:11 by Francesco Casella, 5 years ago

I just had another crash, which left me with a broken library: I added a new class, the new class name was saved into package.order but not in the .mo file, so the tool refuses to load the library.

Of course I know how to fix this myself with a text editor, but this kind of things simply shoulnd't happen. We need to fix this issue and release 1.14.1 with top priority.

On the good side, I guess most people are using OMEdit with drag&drop, rather than to develop new code, so the harm may be limited so far.

comment:12 by Francesco Casella, 5 years ago

I am now running v1.16.0-dev-80-gc2927a9d8, I tried all the actions that caused a crash in 1.14.0 but got none. Maybe I've just been (un)lucky. It seems that the issue was somehow fixed on master in the meantime. I will now try 1.15.0-dev

comment:13 by Adrian Pop, 5 years ago

1.15 and 1.16 should be safe as they contain fix by Adeel: "ticket:5671 Handle the coordinate system change". That is now ported also to mainteanance/1.14 branch.

I could not reproduce the crash with the new class name. I need more info on that, maybe another ticket would be better.

in reply to:  13 comment:14 by Francesco Casella, 5 years ago

Replying to adrpo:

I confirm that the crash of 1.14.0 reported in comment:8 is consistently reproduced both under Windows and Linux.

I can also confirm that the latest 1.15.0-dev and 1.16.0-dev under Windows do not have this problem. On Linux I can't say, because of the broken nightly builds.

1.15 and 1.16 should be safe as they contain fix by Adeel: "ticket:5671 Handle the coordinate system change".

This is 100% consistent with my observations :)

That is now ported also to maintanance/1.14 branch.

Good.

I could not reproduce the crash with the new class name. I need more info on that, maybe another ticket would be better.

I'll see if I can reproduce that for you so you can double check, but I guess it's the same thing.

comment:15 by Francesco Casella, 5 years ago

I tried several times but I couldn't replicate that. I wouldn't mind, in all likelyhood it was the same root cause.

How should we proceed? I guess we should release 1.14.1 quickly, but maybe some testing would be due. However, we can't use the nightly and stable branches anymore to do it.

comment:16 by Francesco Casella, 5 years ago

Agreed with @adrpo that the issue is serious and should definitely be fixed, but probably not affecting many users, since it is triggered only by non-trivial code development activity.

Decision: probably release 1.14.1 next week, before Christmas.

comment:17 by Francesco Casella, 5 years ago

Resolution: fixed
Status: newclosed

The issue has been fixed in 1.14.1 and subsequent versions.

Note: See TracTickets for help on using tickets.