Bug 385449 - KDevelop crashes when clang crashes
Summary: KDevelop crashes when clang crashes
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: 5.1.80
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-06 20:24 UTC by Julian Wolff
Modified: 2017-10-09 15:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Crash log (20.18 KB, text/plain)
2017-10-06 20:24 UTC, Julian Wolff
Details
File that triggers the crash (7.67 KB, text/x-c++src)
2017-10-06 20:25 UTC, Julian Wolff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Wolff 2017-10-06 20:24:49 UTC
Created attachment 108212 [details]
Crash log

Version is 5.1.80. Cannot pick that in form.
Did not happen with 5.1.2.

During initial syntax scan after application startup, the application crashes while parsing a file (always the same).
Crash log attached. 

Console output is:

libclang: crash detected during parsing: {
  'source_filename' : '/home/wolff/repos/masterthesis/src/feature_extraction/signalprocessor.cpp'
  'command_line_args' : ['clang', '-ferror-limit=100', '-fspell-checking', '-Wdocumentation', '-Wunused-parameter', '-Wunreachable-code', '-Wall', '-std=c++11', '-nostdinc', '-nostdinc++', '-xc++', '-isystem/usr/include/c++/7.2.0', '-isystem/usr/include/c++/7.2.0/x86_64-pc-linux-gnu', '-isystem/usr/include/c++/7.2.0/backward', '-isystem/usr/local/include', '-isystem/usr/lib/clang/5.0.0/include', '-isystem/usr/include', '-imacros', '/tmp/kdevelop.TJ1747'],
  'unsaved_files' : [],
  'options' : 781,
}
QSocketNotifier: Invalid socket 7 and type 'Read', disabling...
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
KCrash: Application 'kdevelop' crashing...
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
QSocketNotifier: Invalid socket 25 and type 'Read', disabling...
QSocketNotifier: Invalid socket 191 and type 'Read', disabling...
QSocketNotifier: Invalid socket 193 and type 'Exception', disabling...
QSocketNotifier: Invalid socket 34 and type 'Read', disabling...
QSocketNotifier: Invalid socket 428 and type 'Read', disabling...
QSocketNotifier: Invalid socket 416 and type 'Read', disabling...
QSocketNotifier: Invalid socket 446 and type 'Read', disabling...
QSocketNotifier: Invalid socket 38 and type 'Read', disabling...
QSocketNotifier: Invalid socket 42 and type 'Read', disabling...
QSocketNotifier: Invalid socket 190 and type 'Read', disabling...
QSocketNotifier: Invalid socket 192 and type 'Read', disabling...
QSocketNotifier: Invalid socket 288 and type 'Read', disabling...
QSocketNotifier: Invalid socket 183 and type 'Read', disabling...
Comment 1 Julian Wolff 2017-10-06 20:25:40 UTC
Created attachment 108213 [details]
File that triggers the crash
Comment 2 Sven Brauch 2017-10-06 20:46:18 UTC
Hm, doesn't crash here, but it doesn't parse much of that file without context. Is the project available somewhere (github or so) so I could load the whole project?
Comment 3 Julian Wolff 2017-10-06 21:05:29 UTC
(In reply to Sven Brauch from comment #2)
> Hm, doesn't crash here, but it doesn't parse much of that file without
> context. Is the project available somewhere (github or so) so I could load
> the whole project?

Unfortunately I am not allowed to share the full code...
I downgraded Kdevelop for now. Maybe I have time to track down the issue tomorrow.

Thanks for testing!
Comment 4 Francis Herne 2017-10-06 21:37:04 UTC
Have you tried compiling that file using standalone `clang` with the arguments as passed by KDevelop?

(see the 'command_line_args' section of your error output; swap /tmp/kdevelop.TJ1747 for the actual filename).

If that crashes, then it's a clang bug rather than a KDevelop one.
Comment 5 Julian Wolff 2017-10-06 22:52:28 UTC
Francis, you're right. clang standalone crashes too.

I now also noticed that KDevelop 5.1.2 shows the crash of clang in the console output. Yet, KDevelop 5.1.2 keeps on running while KDevelop 5.1.80 crashes.
Comment 6 Francis Herne 2017-10-06 22:58:38 UTC
Possibly the 5.1.2 package in Arch is built against an older version of libclang?

Otherwise, there've been some changes to the handling of compiler arguments and include paths; 5.1.80 might be passing a slightly-different set of parameters that trigger this somehow.

Try removing/changing the clang arguments and/or sections of your file to narrow down the bug, get a backtrace for standalone clang, then file a bug upstream if it isn't already known.
Comment 7 Francis Herne 2017-10-06 23:01:43 UTC
Disregard the first few lines; I misread your comment. Time to sleep...
Comment 8 Julian Wolff 2017-10-09 15:42:16 UTC
Filed a clang bug at https://bugs.llvm.org/show_bug.cgi?id=34885

Still, it would be great if KDevelop would not crash when clang crashes (like it was in 5.1.2, at least for my case).
Comment 9 Kevin Funk 2017-10-09 15:49:11 UTC
@Julian: Note: You can change the command-line arguments used to parse code inside KDevelop via Project -> Open Configuration -> Language Support -> C/C++ Parser -> C++ Profile.

Try to remove or overwrite -Wall there.


Also note: Due to the way KDevelop interacts with libclang (in-process) it will inherently crash if libclang causes a segfault. That's not easy to solve or work-around unfortunately.

Thanks for reporting the bug upstream!