[tracker] monitor: use openfiles max limits in the kqueue case



commit 0b3d4831a488427abbdbaef988b01f74a0870f9a
Author: Antoine Jacoutot <ajacoutot gnome org>
Date:   Fri Nov 15 06:20:18 2013 +0100

    monitor: use openfiles max limits in the kqueue case
    
    kqueue(2) is very hungry for FDs when monitoring files and directories,
    so use the max NOFILES value as a base for setting up monitor limits.
    This mitigate the chance to run into the infamous "Too many open files"...
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712349

 src/libtracker-miner/tracker-monitor.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 9b1ab4e..2f9d7f0 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -420,7 +420,13 @@ get_kqueue_limit (void)
 
 #ifdef TRACKER_MONITOR_KQUEUE
        struct rlimit rl;
-       if (getrlimit (RLIMIT_NOFILE, &rl) == 0)
+       if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
+               rl.rlim_cur = rl.rlim_max;
+       } else {
+               return limit;
+       }
+
+       if (setrlimit(RLIMIT_NOFILE, &rl) == 0)
                limit = (rl.rlim_cur * 90) / 100;
 #endif /* TRACKER_MONITOR_KQUEUE */
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]