Bug 349512 - Konsole and other KDE Apps Crash during KWindowSystemPrivateX11::viewportToDesktop
Summary: Konsole and other KDE Apps Crash during KWindowSystemPrivateX11::viewportToDe...
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-kwindowsystem
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2015-06-23 01:37 UTC by matt
Modified: 2018-12-01 03:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (4.39 KB, text/plain)
2015-06-23 22:28 UTC, matt
Details
New crash information added by DrKonqi (4.92 KB, text/plain)
2015-06-25 12:44 UTC, matt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matt 2015-06-23 01:37:25 UTC
Application: konsole (15.04.0)

Qt Version: 5.4.1
Operating System: Linux 3.19.0-21-generic x86_64
Distribution: Ubuntu 15.04

-- Information about the crash:
- What I was doing when the application crashed:
Resuming from Sleep

- Custom settings of the application:
This is Dell-installed Ubuntu 14.04, with Kubuntu-desktop package(s) added, upgraded to 15.04.  It doesn't seem to matter whether I'm logged into KDE or Unity.

The crash can be reproduced sometimes.

-- Backtrace:
Application: Konsole (konsole), signal: Floating point exception
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f86d2eaf800 (LWP 2722))]

Thread 4 (Thread 0x7f86bf22b700 (LWP 2723)):
#0  0x00007f86d29888dd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f86ccc6db72 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f86ccc6f64f in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f86c114f099 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
#4  0x00007f86cf2bdb0e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f86cae676aa in start_thread (arg=0x7f86bf22b700) at pthread_create.c:333
#6  0x00007f86d2993eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f86b26f6700 (LWP 2725)):
#0  0x00007f86d298449d in read () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f86ca7762f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f86ca73296c in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f86ca732e60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f86ca733242 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f86bcedcae6 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#6  0x00007f86ca759955 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007f86cae676aa in start_thread (arg=0x7f86b26f6700) at pthread_create.c:333
#8  0x00007f86d2993eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f86b14c1700 (LWP 2726)):
#0  0x00007f86d29888dd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f86ca732ebc in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f86ca732fcc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f86ca733009 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f86ca759955 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f86cae676aa in start_thread (arg=0x7f86b14c1700) at pthread_create.c:333
#6  0x00007f86d2993eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f86d2eaf800 (LWP 2722)):
[KCrash Handler]
#6  KWindowSystemPrivateX11::viewportToDesktop (this=0x2092590, p=...) at ../../src/kwindowsystem_x11.cpp:1103
#7  0x00007f86d2041728 in KWindowSystemPrivateX11::currentDesktop (this=0x2092590) at ../../src/kwindowsystem_x11.cpp:486
#8  0x00007f86d203fe4a in NETEventFilter::nativeEventFilter (this=0x2091ea0, ev=0x7f86b80092d0) at ../../src/kwindowsystem_x11.cpp:194
#9  0x00007f86cf4f8510 in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007f86c114e02d in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
#11 0x00007f86c114f4bb in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
#12 0x00007f86cf52d73a in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007f86cfe05b2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007f86cfe0b000 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007f86cf4fbc2b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007f86cf4fdc9b in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007f86cf554843 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007f86ca732c3d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007f86ca732f20 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007f86ca732fcc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007f86cf554c57 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007f86cf4f93e2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007f86cf50102c in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007f86d2c7886f in kdemain (argc=1, argv=0x7ffd31932448) at ../../src/main.cpp:90
#25 0x00007f86d28ada40 in __libc_start_main (main=0x400730 <main(int, char**)>, argc=1, argv=0x7ffd31932448, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd31932438) at libc-start.c:289
#26 0x0000000000400769 in _start ()

Reported using DrKonqi
Comment 1 matt 2015-06-23 22:28:20 UTC
Created attachment 93315 [details]
New crash information added by DrKonqi

konsole (15.04.0) using Qt 5.4.1

- What I was doing when the application crashed:

Just before this, I unplugged two external monitors.  During the regeneration of the screen, Konsole crashed.  It does this frequently, particularly when monitor readjustment occurs.  Probably why it often seems to happen when resuming from sleep.

-- Backtrace (Reduced):
#6  KWindowSystemPrivateX11::viewportToDesktop (this=0x22eb560, p=...) at ../../src/kwindowsystem_x11.cpp:1103
#7  0x00007f667fe3e728 in KWindowSystemPrivateX11::currentDesktop (this=0x22eb560) at ../../src/kwindowsystem_x11.cpp:486
#8  0x00007f667fe3ce4a in NETEventFilter::nativeEventFilter (this=0x242b6b0, ev=0x7f66680070b0) at ../../src/kwindowsystem_x11.cpp:194
#9  0x00007f667d2f5510 in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
[...]
#12 0x00007f667d32a73a in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
Comment 2 matt 2015-06-25 12:44:19 UTC
Created attachment 93335 [details]
New crash information added by DrKonqi

konsole (15.04.0) using Qt 5.4.1

- What I was doing when the application crashed:

I suspended the laptop, then resumed.  This happens almost every time I suspend/resume.  This time I was running in Unity, but the same happens when running within KDE.

-- Backtrace (Reduced):
#6  KWindowSystemPrivateX11::viewportToDesktop (this=0x1a04990, p=...) at ../../src/kwindowsystem_x11.cpp:1103
#7  0x00007fd7baf0f728 in KWindowSystemPrivateX11::currentDesktop (this=0x1a04990) at ../../src/kwindowsystem_x11.cpp:486
#8  0x00007fd7baf0de4a in NETEventFilter::nativeEventFilter (this=0x18ce930, ev=0x7fd7a0007370) at ../../src/kwindowsystem_x11.cpp:194
#9  0x00007fd7b83c6510 in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
[...]
#12 0x00007fd7b83fb73a in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
Comment 3 Stefan Vater 2015-09-04 07:54:30 UTC
This also happens on my machine with OpenSUSE Tumbleweed, KDE Applications 15.08, Frameworks 15.12. Very annoying! 

I do not know how to add additional information, since I only observe that konsole has gone after resume.
Comment 4 matt 2015-09-04 12:27:14 UTC
It seems that Konsole is not the only app that crashes upon suspend/resume (and sometimes plugging in or unplugging external monitors).  kwin_x11 and plasmashell also crash during these events.  None of them crash all the time, but it's clearly tied to these events.

It seems like the renegotiating of desktop space or display configuration is causing the apps to crash.  Could it be that some resource is temporarily unavailable that these apps are trying to talk to?  KDE does take a long time to reorient when monitors are plugged/unplugged.  It's possible this is some sort of race condition during the reconfiguring of desktop space (which would make sense to also happen during suspend/resume).

What's going on at this point to cause the crashes?
#6  KWindowSystemPrivateX11::viewportToDesktop (this=0x22eb560, p=...) at ../../src/kwindowsystem_x11.cpp:1103

Help?
Comment 5 matt 2015-09-04 13:03:14 UTC
Assuming "apt-get source kwindowsystem" gave me the right source, the crash is happening here:

int KWindowSystemPrivateX11::viewportToDesktop(const QPoint &p)
{
    init(INFO_BASIC);
    NETEventFilter *const s_d = s_d_func();
    NETSize s = s_d->desktopGeometry();
    QSize vs = qApp->desktop()->size();
/////  RIGHT HERE
    int xs = s.width / vs.width();
///////  ^^^^^^^^
    int x = p.x() < 0 ? 0 : p.x() >= s.width ? xs - 1 : p.x() / vs.width();
    int ys = s.height / vs.height();
    int y = p.y() < 0 ? 0 : p.y() >= s.height ? ys - 1 : p.y() / vs.height();
    return y * xs + x + 1;
}


If by chance this is being called while vs.width() returns 0 (which seems a possibility while the system is resuming from sleep or renegotiating Desktop size with multiple monitors), this would cause a  Floating point exception as indicated by DrKonqi.

Help please?  I'm new to the codebase.  When would vs.width() return 0?  Perhaps while an object (possibly qApp-desktop() ? ) is being initialized/setup with real values?  Perhaps in an exception mode where 0 is returned?
Comment 6 Ole Langbehn 2015-11-09 21:02:55 UTC
I'm able to reproduce this reliably on my box.

* start i3wm
* start konsole in scratchpad
* with konsole displayed, from konsole tab, call
# xrandr --output eDP1 --off; sleep 3; xrandr --output eDP1 --auto
(turning off/on my only display)

The crash does not happen when konsole is in tiling or floating mode (not in scratchpad mode)

Core was generated by `konsole -name konsole_scratchpad'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0  KWindowSystemPrivateX11::viewportToDesktop (this=0x19da3c0, p=...) at /var/tmp/portage/kde-frameworks/kwindowsystem-5.15.0/work/kwindowsystem-5.15.0/src/platforms/xcb/kwindowsystem.cpp:1095
1095    /var/tmp/portage/kde-frameworks/kwindowsystem-5.15.0/work/kwindowsystem-5.15.0/src/platforms/xcb/kwindowsystem.cpp: No such file or directory.
[Current thread is 1 (Thread 0x7f1d1d3687c0 (LWP 6450))]
(gdb) bt
#0  KWindowSystemPrivateX11::viewportToDesktop (this=0x19da3c0, p=...) at /var/tmp/portage/kde-frameworks/kwindowsystem-5.15.0/work/kwindowsystem-5.15.0/src/platforms/xcb/kwindowsystem.cpp:1095
#1  0x00007f1d0a9c2ec8 in KWindowSystemPrivateX11::currentDesktop (this=0x19da3c0) at /var/tmp/portage/kde-frameworks/kwindowsystem-5.15.0/work/kwindowsystem-5.15.0/src/platforms/xcb/kwindowsystem.cpp:486
#2  0x00007f1d0a9c0e6c in NETEventFilter::nativeEventFilter (this=0x1a20540, ev=0x7f1d04005280) at /var/tmp/portage/kde-frameworks/kwindowsystem-5.15.0/work/kwindowsystem-5.15.0/src/platforms/xcb/kwindowsystem.cpp:194
#3  0x00007f1d19a7994c in QAbstractEventDispatcher::filterNativeEvent (this=<optimized out>, eventType=..., message=message@entry=0x7f1d04005280, result=result@entry=0x7ffd60c6fb18) at kernel/qabstracteventdispatcher.cpp:460
#4  0x00007f1d0ccec7a5 in QXcbConnection::handleXcbEvent (this=this@entry=0x19a5960, event=event@entry=0x7f1d04005280) at qxcbconnection.cpp:1020
#5  0x00007f1d0ccee8cb in QXcbConnection::processXcbEvents (this=0x19a5960) at qxcbconnection.cpp:1502
#6  0x00007f1d19aa4e9a in QObject::event (this=0x19a5960, e=<optimized out>) at kernel/qobject.cpp:1239
#7  0x00007f1d1a2cd69c in QApplicationPrivate::notify_helper (this=this@entry=0x199a2e0, receiver=receiver@entry=0x19a5960, e=e@entry=0x7f1d04005490) at kernel/qapplication.cpp:3716
#8  0x00007f1d1a2d2b10 in QApplication::notify (this=0x7ffd60c70270, receiver=0x19a5960, e=0x7f1d04005490) at kernel/qapplication.cpp:3499
#9  0x00007f1d19a7bb9d in QCoreApplication::notifyInternal (this=0x7ffd60c70270, receiver=0x19a5960, event=event@entry=0x7f1d04005490) at kernel/qcoreapplication.cpp:965
#10 0x00007f1d19a7e973 in QCoreApplication::sendEvent (event=0x7f1d04005490, receiver=<optimized out>) at kernel/qcoreapplication.h:224
#11 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x1956410) at kernel/qcoreapplication.cpp:1593
#12 0x00007f1d19a7ef38 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1451
#13 0x00007f1d19ac9523 in postEventSourceDispatch (s=0x19c80d0) at kernel/qeventdispatcher_glib.cpp:271
#14 0x00007f1d13e558fd in g_main_dispatch (context=0x7f1d04002450) at /var/tmp/portage/dev-libs/glib-2.44.1-r1/work/glib-2.44.1/glib/gmain.c:3122
#15 g_main_context_dispatch (context=context@entry=0x7f1d04002450) at /var/tmp/portage/dev-libs/glib-2.44.1-r1/work/glib-2.44.1/glib/gmain.c:3737
#16 0x00007f1d13e55be0 in g_main_context_iterate (context=context@entry=0x7f1d04002450, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.44.1-r1/work/glib-2.44.1/glib/gmain.c:3808
#17 0x00007f1d13e55c8c in g_main_context_iteration (context=0x7f1d04002450, may_block=1) at /var/tmp/portage/dev-libs/glib-2.44.1-r1/work/glib-2.44.1/glib/gmain.c:3869
#18 0x00007f1d19ac9597 in QEventDispatcherGlib::processEvents (this=0x19c4130, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#19 0x00007f1d19a7a7ba in QEventLoop::exec (this=this@entry=0x7ffd60c70130, flags=..., flags@entry=...) at kernel/qeventloop.cpp:204
#20 0x00007f1d19a81b9c in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1229
#21 0x00007f1d19da032c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1527
#22 0x00007f1d1a2c92d5 in QApplication::exec () at kernel/qapplication.cpp:2976
#23 0x00007f1d1d1250eb in kdemain (argc=3, argv=0x7ffd60c703b8) at /var/tmp/portage/kde-apps/konsole-15.08.2/work/konsole-15.08.2/src/main.cpp:113
#24 0x00007f1d1cd87630 in __libc_start_main (main=0x400790 <main(int, char**)>, argc=3, argv=0x7ffd60c703b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd60c703a8) at libc-start.c:289
#25 0x00000000004007c9 in _start ()

If you need any more information, I'll be happy to provide it.
Comment 7 matt 2016-04-27 03:23:21 UTC
still getting this on mine as well.  Help?
Comment 8 Kurt Hindenburg 2016-05-29 22:51:01 UTC
I can't reproduce here but that code has a lot of possible " / 0" issues.  I'll try to get more help.
Comment 9 Ole Langbehn 2016-05-30 07:04:31 UTC
I am still able to reproduce this issue. It actually breaks my workflow, so I am heavily interested in getting this fixed. If I can help, please tell me how.

I have full debugging symbols on my box.
Comment 10 Andrew Crouthamel 2018-11-01 13:53:57 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 11 Bug Janitor Service 2018-11-16 11:34:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 12 Bug Janitor Service 2018-12-01 03:48:59 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!