Bug 407745 - kdiff3 1.8.1 crash on comparing directories, segmentation fault.
Summary: kdiff3 1.8.1 crash on comparing directories, segmentation fault.
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Unclassified
Component: application (show other bugs)
Version: 1.8.x
Platform: Other Linux
: NOR crash with 21 votes (vote)
Target Milestone: ---
Assignee: michael
URL:
Keywords:
: 411391 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-20 07:33 UTC by Vasiliy Glazov
Modified: 2020-01-15 00:04 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.8.2


Attachments
Backtrace (10.37 KB, text/x-log)
2019-05-20 07:33 UTC, Vasiliy Glazov
Details
New crash information added by DrKonqi (9.14 KB, patch)
2020-01-13 11:21 UTC, Piotrek Żygieło
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Glazov 2019-05-20 07:33:34 UTC
Created attachment 120195 [details]
Backtrace

SUMMARY
kdiff3 1.8.1 release crash when I compare two simple directories.


STEPS TO REPRODUCE
1. kdiff3 a1 a2
2. Select first different file.
3. Press F6

OBSERVED RESULT
Crash.

EXPECTED RESULT
Normal work.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 30
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.58.0
Qt Version: 5.12.1

ADDITIONAL INFORMATION
Backtrace from gdb:

#0  QAction::setEnabled (this=0x0, b=b@entry=false) at kernel/qaction.cpp:1022
#1  0x00005555555e899d in MergeResultWindow::slotUpdateAvailabilities (this=0x7fffc801de70, bMergeEditorVisible=bMergeEditorVisible@entry=false, 
    bTripleDiff=<optimized out>) at /usr/src/debug/kdiff3-1.8.1-1.fc30.x86_64/src/mergeresultwindow.cpp:183
#2  0x00005555555b823a in KDiff3App::slotUpdateAvailabilities (this=0x555555812d70) at /usr/src/debug/kdiff3-1.8.1-1.fc30.x86_64/src/pdiff.cpp:2456
#3  0x00007ffff69896f0 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffbc00, r=0x555555812d70, this=0x555555b7bc30)
    at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#4  QMetaObject::activate (sender=0x555555b49b00, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3770
#5  0x00007ffff72fb2e0 in QWidget::event (this=this@entry=0x555555b49b00, event=event@entry=0x7fffffffc070) at kernel/qwidget.cpp:9039
#6  0x00007ffff73a7fd2 in QFrame::event (this=this@entry=0x555555b49b00, e=e@entry=0x7fffffffc070) at widgets/qframe.cpp:550
#7  0x00007ffff73aac51 in QAbstractScrollArea::event (this=this@entry=0x555555b49b00, e=e@entry=0x7fffffffc070)
    at widgets/qabstractscrollarea.cpp:1168
#8  0x00007ffff752bca3 in QAbstractItemView::event (this=0x555555b49b00, event=0x7fffffffc070) at itemviews/qabstractitemview.cpp:1682
#9  0x00007ffff72b8ad6 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x555555b49b00, e=0x7fffffffc070)
    at kernel/qapplication.cpp:3753
#10 0x00007ffff72c1f50 in QApplication::notify(QObject*, QEvent*) () at kernel/qapplication.cpp:3500

Full backtrace attached.
Comment 1 Vadym Krevs 2019-05-22 09:54:26 UTC
Same on openSUSE Leap 15.0

kdiff3-1.8.1-lp150.18.1.x86_64
plasma-framework-5.58.0-lp150.249.1.x86_64
plasma5-workspace-5.15.90-lp150.456.1.x86_64
libQt5Core5-5.12.3-lp150.2.1.x86_64
Comment 2 Knut Hildebrandt 2019-11-25 05:04:17 UTC
Same on Chakra Linux.

KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2

In my case kdiff3 does not always crash, but only if comparing directories containing many or huge files. I also did not get the segmentation fault.

And kdiff3 actually more often hangs than crashes. If it hangs this can happen at any moment of comparison, at 17%, 50% or even 99%.

All above said holds true for "Binary comparison".

Using "Fuall analysis" I got this output on crashing:
$ kdiff3
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
KCrash: Application 'kdiff3' crashing...
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0

Using "Trust size and date but use binary ..." the output looked like that:
$ kdiff3
QSocketNotifier: Invalid socket 8 and type 'Read', disabling...
Unable to start Dr. Konqi
Re-raising signal for core dump handling.
The per-process limit on the number of open file descriptors has been reached.
ERROR: cannot create wakeup pipe

"Trust size" and "Trust size and modification date" worked fine.
Comment 3 Knut Hildebrandt 2019-11-25 05:09:19 UTC
Running "Binary comparison" again I got this on crashing:
$ kdiff3
The per-process limit on the number of open file descriptors has been reached.
ERROR: cannot create wakeup pipe
qt.qpa.xcb: xcb_shm_create_segment() failed for size 163480
The X11 connection broke (error 7). Did the X11 server die?

But this error message does not always appear.
Comment 4 michael 2019-11-26 00:48:16 UTC
(In reply to Knut Hildebrandt from comment #3)
> Running "Binary comparison" again I got this on crashing:
> $ kdiff3
> The per-process limit on the number of open file descriptors has been
> reached.
> ERROR: cannot create wakeup pipe
> qt.qpa.xcb: xcb_shm_create_segment() failed for size 163480
> The X11 connection broke (error 7). Did the X11 server die?
> 
> But this error message does not always appear.

Binary comparison is known but separate issue. Currently this is disabled in supported release versions for exactly this reason it doesn't work reliably. The specific error you are reporting is fixed in 1.8.1. Please advise your distro to back port the fix. This is not the only issue with regard to binary data.
Comment 5 michael 2019-11-26 00:51:44 UTC
(In reply to michael from comment #4)
> (In reply to Knut Hildebrandt from comment #3)
Disregard the reference to binary file comparison I misread your message in any event 1.8.1 addresses the file descriptor issue.
Comment 6 michael 2019-11-26 01:07:53 UTC
Looks like that too many files bug will fixed in 1.8.2 the current 1.8 and master branches have  the fix but it landed after the release for 1.8.1.  It looks the crash on rescan is also addressed.
commit 4ad69790f5864c42fd1296b5bfe43e7e77350516 for the too many file descriptors bug and
d4239b92b1ded1501a6d98a4674ce721ebc3256c for the crash

Could you all please verify this is the case?
Comment 7 michael 2019-11-26 02:21:03 UTC
*** Bug 411391 has been marked as a duplicate of this bug. ***
Comment 8 Piotrek Żygieło 2020-01-13 11:21:47 UTC
Created attachment 125087 [details]
New crash information added by DrKonqi

kdiff3 (1.8.1 (64 bit)) using Qt 5.13.2

- What I was doing when the application crashed:

Similar to report 407745 - comparing two directories. In directory comparison results - double clicked file reported as changed, and kdiff3 crashed.

-- Backtrace (Reduced):
#5  0x00007fb33f10bbd9 in QAction::setEnabled(bool) () at /lib64/libQt5Widgets.so.5
#6  0x0000563f214dd9cd in MergeResultWindow::slotUpdateAvailabilities(bool, bool) ()
[...]
#9  0x00007fb33f152f90 in QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#10 0x00007fb33f201f62 in QFrame::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#11 0x00007fb33f204c71 in QAbstractScrollArea::event(QEvent*) () at /lib64/libQt5Widgets.so.5
Comment 9 Vasiliy Glazov 2020-01-13 11:29:04 UTC
(In reply to michael from comment #6)
> Looks like that too many files bug will fixed in 1.8.2 the current 1.8 and
> master branches have  the fix but it landed after the release for 1.8.1.  It
> looks the crash on rescan is also addressed.
> commit 4ad69790f5864c42fd1296b5bfe43e7e77350516 for the too many file
> descriptors bug and
> d4239b92b1ded1501a6d98a4674ce721ebc3256c for the crash
> 
> Could you all please verify this is the case?

With this patches still crashing at directory comparsion.
Comment 10 michael 2020-01-14 02:18:52 UTC
Are you still experiancing missing menu items as in https://bugs.kde.org/show_bug.cgi?id=411602? If so you do not have the patch that should fix this as well.
Please verify with current 1.8 branch this is will very soon be released as 1.8.2.
Comment 11 michael 2020-01-14 03:40:29 UTC
Looks like  3828f2e7211b8b1441cc5fd53ebdf268ab477c68 was the one I was looking for in this case. There was a different crash issue fixed in d4239b92b1ded1501a6d98a4674ce721ebc3256c.
You will also need 0737cc3e2ddf75fcd69efb385303e0cab3e2db48 to completely fix the open file issue due to a botched merge attempt. All needed patches are in the current master and 1.8 branch.
Comment 12 Vasiliy Glazov 2020-01-14 07:20:04 UTC
Thanks with addin new patches it work good.
Hope 1.8.2 will be released soon :)