Bug 408991 - Kdiff3 1.8.1 hangs on comparing two large directories
Summary: Kdiff3 1.8.1 hangs on comparing two large directories
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: 1.8.x
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-21 12:21 UTC by Slaviro
Modified: 2019-07-26 23:31 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Slaviro 2019-06-21 12:21:12 UTC
SUMMARY
When comparing something very huge (in my case - two AOSP Android trees) Kdiff3-1.8.1 hangs deadly and can only be killed.

STEPS TO REPRODUCE
1. Select some large directories with 500000+ files adn directories (AOSP tree fits)
2. Exclude .repo directory from comparison.
3. Kdiff them with either KDE Menu or with direct kdiff3 dir1 dir2
4. Wait for some time

OBSERVED RESULT
Kdiff3 hangs deadly, progress stops, window doesn't react on user input.

EXPECTED RESULT
Correct behavior like on version 0.9.98.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: 
Gentoo Linux
KDE Plasma Version: 5.16.1
KDE Frameworks Version: 5.59.0
Qt Version: 5.12.3

ADDITIONAL INFORMATION
When Kdiff3 hangs, no error message is shown. No extra ordinary messages appear in journalctl. Some time ago, on 1.8.0 and earlier I could see some error message but it has never rendered, so I could see a small window with "Error" title and transparent content area.

Typical journalctl looks like:
Jun 21 13:01:11 My-machine kdiff3[4698]: Icon theme "gnome" not found.
Jun 21 13:03:00 My-machine kwin_x11[2246]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 12654, resource id: 26336622, major code: 3 (GetWindowAttributes), minor code: 0
Jun 21 13:03:00 My-machine kwin_x11[2246]: qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 12655, resource id: 26336622, major code: 14 (GetGeometry), minor code: 0
Jun 21 13:03:23 My-machine kwin_x11[2246]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 14267, resource id: 26337975, major code: 3 (GetWindowAttributes), minor code: 0
Jun 21 13:03:23 My-machine kwin_x11[2246]: qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 14268, resource id: 26337975, major code: 14 (GetGeometry), minor code: 0
Comment 1 michael 2019-07-07 02:27:26 UTC
https://phabricator.kde.org/D22294 looks like it should fix your problem. This address an issue with files not being closed.
Comment 2 Slaviro 2019-07-19 14:39:59 UTC
(In reply to michael from comment #1)
> https://phabricator.kde.org/D22294 looks like it should fix your problem.
> This address an issue with files not being closed.

It seems to have fixed the problem
Comment 3 Wolfgang Bauer 2019-07-20 11:03:13 UTC
I had the same problem when comparing two folders, and I can confirm that https://phabricator.kde.org/D22294 fixed it for me too.

But: the commit to the 1.8 branch is incomplete:
https://cgit.kde.org/kdiff3.git/commit/?h=1.8&id=804997e45675e1ea1e86559d11f118d73fca8ce0
It misses a (the most important?) part.

I had to add these lines (from master) to fix 1.8.1:
         if(memcmp(&buf1[0], &buf2[0], len) != 0)
         {
             bError = false;
+            fi1.close();
+            fi2.close();
             return bEqual;
         }
         sizeLeft -= len;
         //pp.setCurrent(double(fullSize-sizeLeft)/fullSize, false );
         pp.step();
     }
+    fi1.close();
+    fi2.close();
 
     // If the program really arrives here, then the files are really equal.
     bError = false;

Reopening therefore.
Comment 4 michael 2019-07-26 23:31:49 UTC
Git commit 0737cc3e2ddf75fcd69efb385303e0cab3e2db48 by Michael Reeves.
Committed on 26/07/2019 at 17:19.
Pushed by mreeves into branch '1.8'.

Fix botched merge

M  +5    -0    src/directorymergewindow.cpp

https://invent.kde.org/kde/kdiff3/commit/0737cc3e2ddf75fcd69efb385303e0cab3e2db48