[KDE/Mac] Review Request 125123: [WIP] CMake plugin: prevent the QFileSystemWatcher from hitting the open file limit

René J.V. Bertin rjvbertin at gmail.com
Wed Sep 9 20:17:41 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125123/
-----------------------------------------------------------

Review request for KDE Software on Mac OS X and KDevelop.


Repository: kdevelop


Description
-------

This is a confirmed bug in the 4.7 branch (and possibly in the KF5 version) where the cmake project importer can add (many) more paths to QFileSystemWatcher objects than the maximum supported number of open files (https://bugs.kde.org/show_bug.cgi?id=341551). On OS X at least this leads almost inevitably to a crash.

This patch prevents this by keeping track of the number of added paths, and by not adding more than a preconfigured maximum (determined empirically in this draft implementation). 
The crash occurs in `folder = dynamic_cast<CMakeFolderItem*>(f);` in `CMakeCommitChangesJob::makeChanges()`; as an additional protection that function watches the `errno` variable for errors occurring during the `addPath()` operation; if an error is signalled, `folder` is not obtained by dynamic casting but by initialision a new `CMakeFolderItem`.
`makeChanges()` also contains a few ASSERT statements that should remain effective even when building with `QT_NO_DEBUG`; the patch takes care of that as well.

I'm presenting this mostly for reference, in hope it may be useful for Kdevelop/KF5 too. In a real implementation the maximum number of patch watchers would of course be configurable.


Diffs
-----

  projectmanagers/cmake/cmakecommitchangesjob.cpp 7ce24fb 
  projectmanagers/cmake/cmakemanager.h 19fc0c1 
  projectmanagers/cmake/cmakemanager.cpp 2caecdb 

Diff: https://git.reviewboard.kde.org/r/125123/diff/


Testing
-------

On OS X 10.9.5 with kdelibs 4.14.11 and Qt 4.8.7 .
m_MaxAllowedWatchedPaths is set to a value that is reasonably close to the limit where errors start occurring, and large enough to allow loading for instance kdepimlibs, kdepim and kdepim-runtime in a single session.


Thanks,

René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20150909/686749b7/attachment.html>


More information about the kde-mac mailing list