Fix for "Too many open files" bug

Authored by nononux on Jul 5 2019, 10:50 PM.



Sometimes when doing a kdiff3 between two folders, an error popup appear but this popup is empty and kdiff3 cannot be closed anymore (only solution is to kill it).

After a search, it appears the problem comes from the "fastFileComparison" function that opens lots of temporary files but never close them.
The fix has been successfully tested on the buggy directories.

Here is an extract of the backtrace at the instant of the error:

#29 0x00007ffff6235111 in KMessageBox::error (parent=<optimized out>, text=..., caption=..., options=..., options@entry=...) at /home/nono/kde/src/kwidgetsaddons/src/kmessagebox.cpp:779
#30 0x00005555555a142e in DirectoryMergeWindow::DirectoryMergeWindowPrivate::prepareListView (this=this@entry=0x555555d1f220, pp=...) at /home/nono/kde/src/kdiff3/src/directorymergewindow.cpp:1394
#31 0x00005555555a468a in DirectoryMergeWindow::DirectoryMergeWindowPrivate::init (this=0x555555d1f220, dirInfo=..., bDirectoryMerge=<optimized out>, bReload=<optimized out>) at /home/nono/kde/src/kdiff3/src/directorymergewindow.cpp:946
#32 0x00005555555b1dcf in KDiff3App::improveFilenames (this=this@entry=0x5555559df1d0, bCreateNewInstance=bCreateNewInstance@entry=false) at /home/nono/kde/src/kdiff3/src/pdiff.cpp:1881
#33 0x000055555558faec in KDiff3App::completeInit (this=0x5555559df1d0, fn1=..., fn2=..., fn3=...) at /home/nono/kde/src/kdiff3/src/kdiff3.cpp:412
#34 0x0000555555589a40 in KDiff3Shell::KDiff3Shell (this=0x5555558b5820, bCompleteInit=<optimized out>, in_chrg=<optimized out>, vtt_parm=<optimized out>) at /home/nono/kde/src/kdiff3/src/kdiff3_shell.cpp:67
#35 0x0000555555587e45 in main (argc=<optimized out>, argv=<optimized out>) at /home/nono/kde/src/kdiff3/src/main.cpp:171

When printing the "errors" variables of prepareListView, it shows 30 times the messages "Too many open files".

Diff Detail

R983 KDiff3
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
nononux requested review of this revision.Jul 5 2019, 10:50 PM
nononux created this revision.
nononux edited the summary of this revision. (Show Details)Jul 5 2019, 10:54 PM
nononux added a reviewer: mreeves.
mreeves accepted this revision.Jul 7 2019, 2:05 AM

Go catch. Looks like a possible fix for

This revision is now accepted and ready to land.Jul 7 2019, 2:05 AM

Do you have push access or should I commit this?

This revision was automatically updated to reflect the committed changes.