Bug 420820 - Konsole 20.04.0 crashes on start
Summary: Konsole 20.04.0 crashes on start
Status: RESOLVED WORKSFORME
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 20.04.0
Platform: Ubuntu Linux
: HI crash
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2020-04-30 19:08 UTC by Michael Marley
Modified: 2020-05-07 15:37 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Marley 2020-04-30 19:08:28 UTC
Application: konsole (20.04.0)

Qt Version: 5.12.8
Frameworks Version: 5.69.0
Operating System: Linux 5.7.0-050700rc3-lowlatency x86_64
Windowing system: X11
Distribution: Ubuntu Groovy Gorilla (development branch)

-- Information about the crash:
Konsole 20.04.0 crashes every time I try to start it.  I tried deleting the configuration file but that had no effect.  Reverting back to 19.12.x stops the crashing.

I'm using the packages from https://launchpad.net/~kubuntu-ppa/+archive/ubuntu/staging-frameworks.

The crash can be reproduced every time.

-- Backtrace:
Application: Konsole (konsole), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fb80b116800 (LWP 8316))]

Thread 3 (Thread 0x7fb809a3a700 (LWP 8318)):
#0  0x00007fb81056bfec in read () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fb80d31989f in read (__nbytes=16, __buf=0x7fb809a39b60, __fd=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/unistd.h:44
#2  g_wakeup_acknowledge (wakeup=0x7fb804001bc0) at ../../../glib/gwakeup.c:210
#3  0x00007fb80d2d0cfe in g_main_context_check (context=context@entry=0x7fb7fc000c30, max_priority=2147483647, fds=fds@entry=0x7fb7fc0029e0, n_fds=n_fds@entry=1) at ../../../glib/gmain.c:3825
#4  0x00007fb80d2d1152 in g_main_context_iterate (context=context@entry=0x7fb7fc000c30, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4044
#5  0x00007fb80d2d12e3 in g_main_context_iteration (context=0x7fb7fc000c30, may_block=may_block@entry=1) at ../../../glib/gmain.c:4108
#6  0x00007fb80ed6f583 in QEventDispatcherGlib::processEvents (this=0x7fb7fc000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#7  0x00007fb80ed164db in QEventLoop::exec (this=this@entry=0x7fb809a39d70, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140
#8  0x00007fb80eb4e785 in QThread::exec (this=this@entry=0x7fb80e2e9d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at ../../include/QtCore/../../src/corelib/global/qflags.h:120
#9  0x00007fb80e266efa in QDBusConnectionManager::run (this=0x7fb80e2e9d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at qdbusconnection.cpp:178
#10 0x00007fb80eb4f9d2 in QThreadPrivate::start (arg=0x7fb80e2e9d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at thread/qthread_unix.cpp:361
#11 0x00007fb80db35609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#12 0x00007fb81057d103 in clone () from /lib/x86_64-linux-gnu/libc.so.6

Thread 2 (Thread 0x7fb80a250700 (LWP 8317)):
#0  0x00007fb81057096f in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fb80db69c1a in poll (__timeout=-1, __nfds=1, __fds=0x7fb80a24fca8) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2  _xcb_conn_wait (c=c@entry=0x562f6dfbe600, cond=cond@entry=0x562f6dfbe640, vector=vector@entry=0x0, count=count@entry=0x0) at ../../src/xcb_conn.c:480
#3  0x00007fb80db6b90a in xcb_wait_for_event (c=c@entry=0x562f6dfbe600) at ../../src/xcb_in.c:697
#4  0x00007fb80aa74298 in QXcbEventQueue::run (this=0x562f6dfb6c60) at qxcbeventqueue.cpp:228
#5  0x00007fb80eb4f9d2 in QThreadPrivate::start (arg=0x562f6dfb6c60) at thread/qthread_unix.cpp:361
#6  0x00007fb80db35609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#7  0x00007fb81057d103 in clone () from /lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 0x7fb80b116800 (LWP 8316)):
[KCrash Handler]
#5  0x00007fb80f72b9e6 in QAction::shortcut() const () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6  0x00007fb81034f40e in BookmarkMenu::BookmarkMenu (this=0x562f6e00af30, mgr=<optimized out>, owner=<optimized out>, parentMenu=<optimized out>, collection=0x7fb804007800) at ./src/BookmarkMenu.cpp:63
#7  0x00007fb81034e267 in Konsole::BookmarkHandler::BookmarkHandler (this=0x562f6e022a10, collection=<optimized out>, menu=<optimized out>, toplevel=<optimized out>, parent=<optimized out>) at ./src/BookmarkHandler.cpp:68
#8  0x00007fb8106761da in Konsole::MainWindow::setupActions (this=this@entry=0x562f6e01aad0) at ./src/MainWindow.cpp:340
#9  0x00007fb810677f4b in Konsole::MainWindow::MainWindow (this=0x562f6e01aad0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at ./src/MainWindow.cpp:94
#10 0x00007fb81066f270 in Konsole::Application::newMainWindow (this=this@entry=0x7ffe456e4a40) at ./src/Application.cpp:168
#11 0x00007fb81066f565 in Konsole::Application::processWindowArgs (this=this@entry=0x7ffe456e4a40, createdNewMainWindow=@0x7ffe456e48d7: true) at ./src/Application.cpp:416
#12 0x00007fb810670772 in Konsole::Application::newInstance (this=0x7ffe456e4a40) at ./src/Application.cpp:216
#13 0x00007fb810680225 in kdemain (argc=<optimized out>, argv=<optimized out>) at ./src/main.cpp:220
#14 0x00007fb8104820b3 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#15 0x0000562f6d35c09e in _start ()
[Inferior 1 (process 8316) detached]

Possible duplicates by query: bug 303186.

Reported using DrKonqi
Comment 1 Michael Marley 2020-04-30 19:24:57 UTC
It looks like the crash is probably related to https://github.com/KDE/konsole/commit/6db7f8d2593ccb0238b2b547ed6eaf7da6a26c4c.
Comment 2 Kurt Hindenburg 2020-05-01 03:17:48 UTC
Ahmad, could you look at this?
Comment 3 Ahmad Samir 2020-05-01 13:18:26 UTC
Looking at the backtrace, my guess would be it's crashing when trying to access the bookmarkAction pointer in:

    if (bookmarkAction->shortcut() == QKeySequence(Konsole::ACCEL + Qt::Key_B)) {
        collection->setDefaultShortcut(bookmarkAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_B);
    }

which doesn't make sense. I tried to reproduce the issue in a vm, but couldn't install the updates from the ppa (I am not an ubuntu user, so I don't know the quirks to get stuff to install there). Also I couldn't find a konosle 20.04 in that ppa.
Comment 4 Rik Mills 2020-05-01 13:32:48 UTC
(In reply to Ahmad Samir from comment #3)
I tried to reproduce the issue in a vm, but
> couldn't install the updates from the ppa (I am not an ubuntu user, so I
> don't know the quirks to get stuff to install there). Also I couldn't find a
> konosle 20.04 in that ppa.

Wrong link to the PPA in the bug description. It should be...

https://launchpad.net/~kubuntu-ppa/+archive/ubuntu/staging-kdeapplications
Comment 5 Ahmad Samir 2020-05-01 14:46:52 UTC
I preface this by saying I've never run ubuntu before, so.

It seems to me you're installing konsole 20.04 from groovy ppa, but kbookmarks-5.69 comes from "focal" ppa? is that supposed to work?
Comment 6 Michael Marley 2020-05-01 14:59:00 UTC
Oops, right you are.  I still had the Frameworks 5.69 from Focal installed from before I upgraded to Groovy.  If I install 5.68 from Groovy, Konsole doesn't crash.  I'm assuming if Konsole was actually built against 5.69, it would not crash.  I don't see "REPORTER IS IDIOT" in the resolution reason list, so I am closing this as "NOT A BUG".  Sorry for wasting everyone's time.
Comment 7 Christoph Feck 2020-05-01 15:06:08 UTC
Well, frameworks are supposed to be compatible. The only "allowed" crash is if you build Konsole against 5.69, but then run it against 5.68.

If you build Konsole against 5.68, it must work with 5.68 and 5.69.
Comment 8 Rik Mills 2020-05-01 15:15:42 UTC
FYI 5.69 was built for focal in the staging PPA, but not shipped as it was too late to get in. We thought it might be good for early backports, but Nate suggested skipping 5.69 to wait for 5.70 for groovy and focal backports, as 5.69 had some bugs that would need a fair amount a patch cherry=picking from 5.70.

So 5.69 is siting there in a PPA for focal, but is not going anywhere. Testers who added that to focal and who are now on groovy, are in a slightly odd situation right now.

The packages in the KDE applications PPA (konsole 20.04.0 etc) where built against the 5.68 currently in groovy.
Comment 9 Ahmad Samir 2020-05-01 16:19:05 UTC
@Michael: lucky you, there's actually a bug to be fixed here, so thanks for reporting it. (I've reported many a bug that turned out to be absolutely useless :)).

The issue here is that kbookmarks-5.69 didn't create a KActionCollection, this was fixed in 5.70 https://cgit.kde.org/kbookmarks.git/commit/?id=4b3fc2aedd86505a47b9b185e086ef253e73ede8

We can fix it in konsole by simply checking the action actually exists before hijacking it, I'll submit a patch for review.
Comment 10 Ahmad Samir 2020-05-01 17:59:15 UTC
Thinking about this some more, I think the proper fix is to patch kbookmarks-5.69 with https://cgit.kde.org/kbookmarks.git/commit/?id=4b3fc2aedd86505a47b9b185e086ef253e73ede8 ; IIUC, Rik Mills can handle the PPA.

I've also sent an email to the distributions@kde.org ML to notify packagers of the issue. Also note that KF 5.70 is about to be released anyway.
Comment 11 Michael Marley 2020-05-04 13:37:03 UTC
Rik just put KF5 5.70 in the -staging PPA, but Konsole is still crashing on start for me.
Comment 12 Rik Mills 2020-05-04 13:49:51 UTC
Yes, Konsole 19.12.3 does not crash with Frameworks 5.70. Konsole 20.04.0 DOES crash.
Comment 13 Rik Mills 2020-05-04 14:28:17 UTC
- Konsole 20.04.0 in Ubuntu 20.10 archive built against 5.68 in the Ubuntu 20.04 Groovy archive, does not crash.

- The same Konsole 20.04.0 in Ubuntu 20.10 archive DOES crash when frameworks is upgraded to 5.70 form this PPA: https://launchpad.net/~kubuntu-ppa/+archive/ubuntu/staging-frameworks?field.series_filter=groovy

- Konsole 20.04.0 then rebuilt against 5.70 in that PPA does NOT crash.

Hence with this current situation, when I upgrade frameworks in Groovy from 5.68 to 5.70 next week (we are skipping 5.69) then I will need to rebuild Konsole to avoid it crashing on start.

This is not an ideal or satisfactory thing to have to do on a frameworks upgrade, as binary compatibility should not be broken.
Comment 14 Ahmad Samir 2020-05-04 16:18:48 UTC
Konsole 20.04 built against 5.68 will have selected the path in the code that depends on KBookmarks creating a KActionCollection. KBookmarks-5.70 does create an action collection, so konsole should work without rebuilding AFAICT.

Unless 5.70 was built with disabling deprecated KF API, in which case the KBookmarksMenu ctor that takes a KActionCollection isn't available at all.

@Christoph: if some API was deprecated, then Konsole would need a rebuild, right?
Comment 15 Christoph Feck 2020-05-04 16:47:01 UTC
If deprecated API was disabled, but still used, it should indeed have caused a compilation error.

If it's not disabled, deprecated API needs to work as long as it isn't removed in the next ABI incompatible version. If it cannot be made to work, at least it shouldn't cause crashes.
Comment 16 Ahmad Samir 2020-05-04 17:05:58 UTC
Discussing the issue with kossebau on IRC, I was completely wrong about the deprecation stuff, so please disregard. He investigated the issue further and found the critter causing it: https://phabricator.kde.org/D28800#663274

Will definitely get fixed before KF 5.70 is out.
Comment 17 Ahmad Samir 2020-05-04 20:34:09 UTC
Proposed fix https://phabricator.kde.org/D29427
Comment 18 Ahmad Samir 2020-05-04 21:59:56 UTC
Git commit 8a282319bc9eb6dd73557319cbd59d279493cdab by Ahmad Samir.
Committed on 04/05/2020 at 21:59.
Pushed by ahmadsamir into branch 'master'.

[KBookmarkMenu] Assign m_actionCollection early to prevent crash

Summary:
The deprecated ctor that took a KActionCollection param called the new
ctor (that doesn't take an actionCollection before) m_actionCollection was
assigned. This caused the menu actions never to get added to the
actionCollection as it was still nullptr. This caused crashes in
applications that still use the deprecated ctor, e.g. this bug in
konsole https://bugs.kde.org/show_bug.cgi?id=420820.

Since we can't assign m_actionCollection in the initializer list because
then the constructor delegation would follow a member initializer
(info courtsey of the compiler), introduce a helper init method to
reduce code duplication between the two ctor's.

Thanks to Friedrich W. H. Kossebau for figuring it out
https://phabricator.kde.org/D28800#663274.

Test Plan: make && ctest

Reviewers: #frameworks, dfaure, kossebau, nicolasfella

Reviewed By: dfaure

Subscribers: rikmills, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29427

M  +14   -3    src/kbookmarkmenu.cpp
M  +2    -0    src/kbookmarkmenu.h

https://commits.kde.org/kbookmarks/8a282319bc9eb6dd73557319cbd59d279493cdab
Comment 19 Ahmad Samir 2020-05-07 15:37:14 UTC
I tested in an ubuntu vm, and it seems to work. Closing as worksforme, as the fix isn't within konsole but rather kbookmarks. Feel free to reopen if you disagree.