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

Spontaneous "Error Loading Session" occurring sometimes #628

Closed
10110111 opened this Issue Nov 20, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@10110111
Contributor

10110111 commented Nov 20, 2017

In some cases, I've not yet traced in which ones, when I run EDB as edb --run /path/to/my/prog, it opens its main window, and then shows me an empty warning message box, with title "Error Loading Session". Here's how it looks:
screenshot
Stack trace from this state after I attach GDB to EDB:

0x00007efd55524ce0 in do_sigtimedwait (timeout=0x7ffc90cc4a90, info=0x7ffc90cc4b20, set=0x7ffc90cc4aa0) at ../nptl/sysdeps/unix/sysv/linux/../../../../../sysdeps/unix/sysv/linux/sigtimedwait.c:53
53      ../nptl/sysdeps/unix/sysv/linux/../../../../../sysdeps/unix/sysv/linux/sigtimedwait.c: No such file or directory.
(gdb) bt
#0  0x00007efd55524ce0 in do_sigtimedwait (timeout=0x7ffc90cc4a90, info=0x7ffc90cc4b20, set=0x7ffc90cc4aa0) at ../nptl/sysdeps/unix/sysv/linux/../../../../../sysdeps/unix/sysv/linux/sigtimedwait.c:53
#1  __GI___sigtimedwait (set=0x7ffc90cc4aa0, info=0x7ffc90cc4b20, timeout=0x7ffc90cc4a90) at ../nptl/sysdeps/unix/sysv/linux/../../../../../sysdeps/unix/sysv/linux/sigtimedwait.c:81
#2  0x00007efd42b0a019 in DebuggerCorePlugin::native::wait_for_sigchld (msecs=10) at /home/ruslan/mydev/edb-debugger/plugins/DebuggerCore/unix/DebuggerCoreUNIX.cpp:290
#3  0x00007efd42b0d103 in DebuggerCorePlugin::DebuggerCore::wait_debug_event (this=0x1aca560, msecs=10) at /home/ruslan/mydev/edb-debugger/plugins/DebuggerCore/unix/linux/DebuggerCore.cpp:588
#4  0x0000000000582774 in Debugger::next_debug_event (this=0x7ffc90cc5880) at /home/ruslan/mydev/edb-debugger/src/Debugger.cpp:3417
#5  0x000000000064b874 in Debugger::qt_static_metacall (_o=0x7ffc90cc5880, _c=QMetaObject::InvokeMetaMethod, _id=80, _a=0x7ffc90cc4dc0) at /home/ruslan/mydev/edb-debugger/build/src/moc_Debugger.cpp:276
#6  0x00007efd5627787a in QMetaObject::activate (sender=0x1ed15c0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3539
#7  0x00007efd5627ba31 in QObject::event (this=0x1ed15c0, e=<optimized out>) at kernel/qobject.cpp:1156
#8  0x00007efd5726ae2c in QApplicationPrivate::notify_helper (this=this@entry=0x179d700, receiver=receiver@entry=0x1ed15c0, e=e@entry=0x7ffc90cc5180) at kernel/qapplication.cpp:4567
#9  0x00007efd572714a0 in QApplication::notify (this=0x7ffc90cc5d70, receiver=0x1ed15c0, e=0x7ffc90cc5180) at kernel/qapplication.cpp:4353
#10 0x00007efd562634dd in QCoreApplication::notifyInternal (this=0x7ffc90cc5d70, receiver=0x1ed15c0, event=0x7ffc90cc5180) at kernel/qcoreapplication.cpp:953
#11 0x00007efd56293323 in QCoreApplication::sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#12 QTimerInfoList::activateTimers (this=0x17a1860) at kernel/qeventdispatcher_unix.cpp:621
#13 0x00007efd56290629 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:193
#14 idleTimerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:240
#15 0x00007efd54bbbe04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007efd54bbc048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007efd54bbc0ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007efd562907a1 in QEventDispatcherGlib::processEvents (this=0x17a0510, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#19 0x00007efd5730cbe6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#20 0x00007efd562620af in QEventLoop::processEvents (this=this@entry=0x7ffc90cc5400, flags=...) at kernel/qeventloop.cpp:149
#21 0x00007efd562623a5 in QEventLoop::exec (this=this@entry=0x7ffc90cc5400, flags=...) at kernel/qeventloop.cpp:204
#22 0x00007efd5771206c in QDialog::exec (this=this@entry=0x7ffc90cc5490) at dialogs/qdialog.cpp:562
#23 0x00007efd57730cf0 in showNewMessageBox (parent=<optimized out>, icon=icon@entry=QMessageBox::Warning, title=..., text=..., buttons=..., defaultButton=QMessageBox::NoButton) at dialogs/qmessagebox.cpp:1538
#24 0x00007efd57730e2f in QMessageBox::warning (parent=<optimized out>, title=..., text=..., buttons=..., defaultButton=<optimized out>) at dialogs/qmessagebox.cpp:1638
#25 0x000000000057fbe7 in Debugger::set_initial_debugger_state (this=0x7ffc90cc5880) at /home/ruslan/mydev/edb-debugger/src/Debugger.cpp:2881
#26 0x0000000000580da4 in Debugger::attachComplete (this=0x7ffc90cc5880) at /home/ruslan/mydev/edb-debugger/src/Debugger.cpp:3108
#27 0x00000000005805fe in Debugger::common_open (this=0x7ffc90cc5880, s="/home/ruslan/devel/install-prefix/bin/sdpd", args=empty QList<QByteArray>) at /home/ruslan/mydev/edb-debugger/src/Debugger.cpp:3013
#28 0x00000000005807cd in Debugger::execute (this=0x7ffc90cc5880, program="/home/ruslan/devel/install-prefix/bin/sdpd", args=empty QList<QByteArray>) at /home/ruslan/mydev/edb-debugger/src/Debugger.cpp:3032
#29 0x00000000005bc5c0 in (anonymous namespace)::start_debugger (attach_pid=0, program="/home/ruslan/devel/install-prefix/bin/sdpd", programArgs=empty QList<QByteArray>)
    at /home/ruslan/mydev/edb-debugger/src/main.cpp:120
#30 0x00000000005bd780 in main (argc=3, argv=0x7ffc90cc5e78) at /home/ruslan/mydev/edb-debugger/src/main.cpp:242

In particular, frame 25 looks like

(gdb) f 25
#25 0x000000000057fbe7 in Debugger::set_initial_debugger_state (this=0x7ffc90cc5880) at /home/ruslan/mydev/edb-debugger/src/Debugger.cpp:2881
2881                            );
(gdb) list
2876                    if(!SessionManager::instance().load_session(filename, session_error)) {
2877                            QMessageBox::warning(
2878                                    this,
2879                                    tr("Error Loading Session"),
2880                                    QT_TR_NOOP(session_error.getErrorMessage())
2881                            );
2882                    } else {
2883                            QVariantList comments_data;
2884                            SessionManager::instance().get_comments(comments_data);
2885                            ui.cpuView->restoreComments(comments_data);
(gdb) p session_error 
$1 = {err = SessionError::NoError, errorMessage = ""}
@eteran

This comment has been minimized.

Show comment
Hide comment
@eteran

eteran Nov 20, 2017

Owner

I think we can get rid of the QT_TR_NOOP there and assume that getErrorMessage() returns an already internationalized string (well, it should). That will at least tell us what the hell the error is.

Owner

eteran commented Nov 20, 2017

I think we can get rid of the QT_TR_NOOP there and assume that getErrorMessage() returns an already internationalized string (well, it should). That will at least tell us what the hell the error is.

@10110111

This comment has been minimized.

Show comment
Hide comment
@10110111

10110111 Nov 20, 2017

Contributor

No it won't, see the last line in the GDB session I posted.

Contributor

10110111 commented Nov 20, 2017

No it won't, see the last line in the GDB session I posted.

@eteran

This comment has been minimized.

Show comment
Hide comment
@eteran

eteran Nov 20, 2017

Owner

Oh, well that weird. It is returning false even though it is also reporting "NoError".... that doesn't make any sense. OK, we'll have to debug this one a bit.

Owner

eteran commented Nov 20, 2017

Oh, well that weird. It is returning false even though it is also reporting "NoError".... that doesn't make any sense. OK, we'll have to debug this one a bit.

@10110111

This comment has been minimized.

Show comment
Hide comment
@10110111

10110111 Jan 3, 2018

Contributor

I've traced down the problem. It happens when if(file.open(QIODevice::ReadOnly | QIODevice::Text)) { in SessionManager::load_session doesn't execute. In this case session_error remains untouched, the function simply returns false, so we don't have any details. In my cases it happened because the directory corresponding to the binary being debugged does exist, but no session file is present there.

In any case, I think passing error result by reference like "please tell me what the error was" is not a good design, since it's too easy to ignore this caller's request. Instead the function should have Status as return value.

Contributor

10110111 commented Jan 3, 2018

I've traced down the problem. It happens when if(file.open(QIODevice::ReadOnly | QIODevice::Text)) { in SessionManager::load_session doesn't execute. In this case session_error remains untouched, the function simply returns false, so we don't have any details. In my cases it happened because the directory corresponding to the binary being debugged does exist, but no session file is present there.

In any case, I think passing error result by reference like "please tell me what the error was" is not a good design, since it's too easy to ignore this caller's request. Instead the function should have Status as return value.

eteran added a commit that referenced this issue Apr 10, 2018

fixed issue where user would be presented with a useless blank messag…
…ebox during a failure to load a session file.

related to issue #628

I still don't know WHY it sometimes fails, but at least now we'll get a reason when it happens, and hopefully it will be one which the user can address.

eteran added a commit that referenced this issue May 6, 2018

I beleive that this will address issue #628, a missing sessions file
which is common, and happens every time you debug a file for the first time.
So it is reasonable to just silently accept that it doesn't exist.
@eteran

This comment has been minimized.

Show comment
Hide comment
@eteran

eteran May 6, 2018

Owner

should be fixed with latest push. Re-open if this continues to be an issue.

Owner

eteran commented May 6, 2018

should be fixed with latest push. Re-open if this continues to be an issue.

@eteran eteran closed this May 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment