Bug 425841 - SIGPIPE, then a crash when the first event loop starts at least 60 seconds after KDevelop launch
Summary: SIGPIPE, then a crash when the first event loop starts at least 60 seconds af...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-26 18:22 UTC by Igor Kushnir
Modified: 2022-12-27 09:22 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.7.0


Attachments
KDevelop Frame Stack at SIGPIPE (3.58 KB, text/plain)
2020-08-26 18:22 UTC, Igor Kushnir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Kushnir 2020-08-26 18:22:08 UTC
Created attachment 131205 [details]
KDevelop Frame Stack at SIGPIPE

SUMMARY
I have encountered this SIGPIPE followed by a crash many times while I debugged KDevelop. I have to hastily *Continue application execution* when breakpoints are hit during startup in order to circumvent the crash. But sometimes the crash just happens every other time (unless the "Session Crashed" dialog starts an event loop early). One temporary way out of this regular crashing is to speed up KDevelop startup by manually removing all [Working File Sets] entries from the affected session's sessionrc file.

STEPS TO REPRODUCE
1. Open KDevelop project in KDevelop and build it with Debug build type.
2. Place a breakpoint in some function called during startup, for example at the beginning of BreakpointModel::scheduleSave().
3. Debug Launch KDevelop.
4. When the breakpoint is hit, wait for some time before continuing execution (60 seconds is more than enough).
5. Disable the breakpoint or continue execution without waiting at subsequent breakpoint hits.

OBSERVED RESULT
The "*** Program received signal SIGPIPE (Broken pipe) ***" line appears in Debug tool view. The contents of the Frame Stack at this point is attached to the bug. When I press the *Continue application execution* button, KDevelop crashes with the following output in Debug tool view right after the SIGPIPE line quoted above (only the PID number varies, the rest of the output is constant):
ICE default IO error handler doing an exit(), pid = 610216, errno = 32
register count: 0, destroy count: 0
*** Exited with return code: 01 ***

EXPECTED RESULT
The debugged KDevelop instance doesn't receive SIGPIPE signal and doesn't crash.

SOFTWARE/OS VERSIONS
Manjaro GNU/Linux, Xfce
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
It appears that this is a general X11 (possibly Qt-specific) issue. A minimal reproduciple example and a fix are available at https://stackoverflow.com/questions/56686603/how-to-avoid-sigpipe-due-to-a-timeout-when-debugging-an-x11-program. I am going to create a Merge Request with this fix soon.
Comment 1 Francis Herne 2020-09-02 22:04:44 UTC
Git commit 43db1a72dbbe91e231ab7349f202df6a5fb4337c by Francis Herne, on behalf of Igor Kushnir.
Committed on 02/09/2020 at 22:03.
Pushed by flherne into branch 'master'.

Don't crash during a slow (>= 60 seconds) startup

A quick benchmark shows that the added QCoreApplication::processEvents()
call takes the same time - 6 milliseconds - in Debug and Release builds.
6 milliseconds is not a noticeable startup slowdown, especially
considering that the event loop does useful work: processes events,
which would have to be handled eventually anyway.
FIXED-IN: 5.7.0

M  +6    -0    app/main.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/43db1a72dbbe91e231ab7349f202df6a5fb4337c
Comment 2 Igor Kushnir 2021-04-13 21:31:33 UTC
Git commit efff8affd6416e7c9bf47ac4e690742721b6f17c by Igor Kushnir.
Committed on 13/04/2021 at 18:10.
Pushed by igorkushnir into branch 'master'.

test_gdbprinters: don't crash after running for >= 60 seconds

All 27 gdbprinters test cases pass on my computer, but they run for
slightly longer than a minute. Thus a regular crash on exit, which ctest
reports as an overall test failure.

Such a crash during a slow KDevelop startup was worked around in the
same way in 43db1a72dbbe91e231ab7349f202df6a5fb4337c.

M  +5    -0    plugins/gdb/unittests/test_gdbprinters.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/efff8affd6416e7c9bf47ac4e690742721b6f17c
Comment 3 Bug Janitor Service 2022-11-21 10:05:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/406
Comment 4 Igor Kushnir 2022-12-27 09:22:01 UTC
Git commit ade5715866fe28f5781a9db68d82bb1d1f96a7e5 by Igor Kushnir.
Committed on 27/12/2022 at 09:21.
Pushed by igorkushnir into branch 'master'.

test_qthelpplugin: don't crash after running for >= 60 seconds

All 12 qthelpplugin test cases pass on my computer, but occasionally
(when some Qt Help database is updated?) they run for slightly longer
than a minute. Thus an occasional crash on exit.

Such a crash in test_gdbprinters was worked around in the same way in
efff8affd6416e7c9bf47ac4e690742721b6f17c. For some reason the received
signal is now SegFault instead of SIGPIPE.

M  +6    -0    plugins/qthelp/tests/test_qthelpplugin.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/ade5715866fe28f5781a9db68d82bb1d1f96a7e5