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

Crash without useful error message when no display available #40

Closed
nickdesaulniers opened this issue Dec 7, 2016 · 5 comments
Closed

Comments

@nickdesaulniers
Copy link

sshing into my headless server with X window forwarding not set up, I get a crash and core dump because there's no display to attach to. This is stupid and PEBKAC, but maybe this case can be cleaned up to not crash.

➜  qdirstat git:(master) ./src/qdirstat
Logging to /tmp/qdirstat-1000.log
[1]    26606 abort (core dumped)  ./src/qdirstat
➜  qdirstat git:(master) cat /tmp/qdirstat-1000.log
2016-12-06 17:53:40.631 [26606] <Info>    Logger.cpp:75 Logger():  -- Log Start --
2016-12-06 17:53:40.638 [26606] <ERROR>   :0 ():  QXcbConnection: Could not connect to display
@nickdesaulniers
Copy link
Author

for instance, this can be reproduced when sshing from OSX without the -Y flag. With -Y everything works well.

@nickdesaulniers
Copy link
Author

oof it seems to take a while to scan when ssh'ing+X11 forwarding over the local networks. Maybe the scanning is sequentially dependent on updating the display, in order to animate the read job decrements?

@shundhammer
Copy link
Owner

Qt over ssh is slow since Qt 5.x; this is a known problem: #27

There is a command line option as a workaround: #33

@shundhammer
Copy link
Owner

Well, it crashes deep within Qt inside the QApplication constructor:

64	int main( int argc, char *argv[] )
65	{
66	    Logger logger( QString( "/tmp/qdirstat-%1.log" ).arg( getuid() ) );
67	
68	    // Set org/app name for QSettings
69	    QCoreApplication::setOrganizationName( "QDirStat" );
70	    QCoreApplication::setApplicationName ( "QDirStat" );
71	
72	    QApplication app( argc, argv);

^^^^^^^^^^^^^^^^^^^^^^ crash ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

73	    QStringList argList = QCoreApplication::arguments();
74	    argList.removeFirst(); // Remove program name
75	
76	    MainWindow mainWin;
77	    mainWin.show();


(gdb) n
Logging to /tmp/qdirstat-17166.log
69	    QCoreApplication::setOrganizationName( "QDirStat" );
(gdb) n
70	    QCoreApplication::setApplicationName ( "QDirStat" );
(gdb) n
72	    QApplication app( argc, argv);
(gdb) n
Program received signal SIGABRT, Aborted.


(gdb) bt
#0  0x00007ffff548a5af in raise () from /lib64/libc.so.6
#1  0x00007ffff548b9aa in abort () from /lib64/libc.so.6
#2  0x00000000004642f5 in qt_logger (msgType=QtFatalMsg, context=..., msg=...) at Logger.cpp:261
#3  0x00007ffff65df0a8 in ?? () from /usr/lib64/libQt5Core.so.5
#4  0x00007ffff65e0c19 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib64/libQt5Core.so.5
#5  0x00007ffff04b772e in QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) () from /usr/lib64/libQt5XcbQpa.so.5
#6  0x00007ffff04ba8ee in QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) ()
   from /usr/lib64/libQt5XcbQpa.so.5
#7  0x00007ffff077a4dd in ?? () from /usr/lib64/qt5/plugins/platforms/libqxcb.so
#8  0x00007ffff6d095ed in QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) () from /usr/lib64/libQt5Gui.so.5
#9  0x00007ffff6d177d2 in QGuiApplicationPrivate::createPlatformIntegration() ()
   from /usr/lib64/libQt5Gui.so.5
#10 0x00007ffff6d1826d in QGuiApplicationPrivate::createEventDispatcher() () from /usr/lib64/libQt5Gui.so.5
#11 0x00007ffff67cf74f in QCoreApplicationPrivate::init() () from /usr/lib64/libQt5Core.so.5
#12 0x00007ffff6d19d8f in QGuiApplicationPrivate::init() () from /usr/lib64/libQt5Gui.so.5
#13 0x00007ffff74c3619 in QApplicationPrivate::init() () from /usr/lib64/libQt5Widgets.so.5
#14 0x000000000041cecd in main (argc=2, argv=0x7fffffffe128) at main.cpp:72

It crashes because Qt itself calls fatal() which prints an error message and then calls abort() which sends itself a SIGABRT.

The logger could duplicate the fatal error message to stderr, but that's about all the app can do. In particular, it cannot simply continue.

@shundhammer
Copy link
Owner

Now duplicating a fatal message to stderr, and in the particular case of "Could not connect to display" (and only then) simply calling exit(1), not abort() which dumps core:

[shundhammer @ balrog] ~ 10 % ssh morgul
Last login: Wed Dec  7 11:52:30 2016 from 10.160.4.22
Have a lot of fun...
[shundhammer @ morgul] ~ 1 % cd src/misc/qdirstat/src 
[shundhammer @ morgul] ...misc/qdirstat/src 2 % ./qdirstat /tmp
Logging to /tmp/qdirstat-17166.log
FATAL: QXcbConnection: Could not connect to display 

@shundhammer shundhammer changed the title crash when no display available Crash without useful error message when no display available Dec 7, 2016
shundhammer added a commit that referenced this issue Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants