wsd/LOOLWSD.cpp |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit e2e638c468f35322fc123664fd749b199f531780
Author:     Gökhan Karabulut <gokhanet...@gmail.com>
AuthorDate: Sat Aug 8 23:05:17 2020 +0300
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Aug 10 12:20:08 2020 +0200

    tdf#124478: Log maximum file descriptor related limits
    
    The number of available file descriptors in a system limits the number
    of documents we can open. We use an fd for client connection, another fd
    for communication with a kit process and a wakeup pipe with 2 fds.
    Therefore, we are left with the maximum number of fds divided by 4
    documents. Out of these documents, reserve 8 (i.e., 32 fds) and log the
    remaining number of documents allowed by the system. Note that Online
    instance can further configure a limit for the maximum number of open
    documents, which is also logged.
    
    Also log the maximum file descriptor allowed by the system, which is the
    number of available file descriptors - 1.
    
    Change-Id: I3972690a6c9995e8d74dcfe25fe87b1ef4c33d4b
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100393
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 02feb23b7..b8c75e5b5 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -41,6 +41,7 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/resource.h>
 
 #include <cassert>
 #include <cerrno>
@@ -1327,6 +1328,13 @@ void LOOLWSD::initialize(Application& self)
         LOOLWSD::MaxDocuments = LOOLWSD::MaxConnections;
     }
 
+    struct rlimit rlim;
+    ::getrlimit(RLIMIT_NOFILE, &rlim);
+    LOG_INF("Maximum file descriptor supported by the system: " << 
rlim.rlim_cur - 1);
+    // 4 fds per document are used for client connection, Kit process 
communication, and
+    // a wakeup pipe with 2 fds. 32 fds (i.e. 8 documents) are reserved.
+    LOG_INF("Maximum number of open documents supported by the system: " << 
rlim.rlim_cur / 4 - 8);
+
     LOG_INF("Maximum concurrent open Documents limit: " << 
LOOLWSD::MaxDocuments);
     LOG_INF("Maximum concurrent client Connections limit: " << 
LOOLWSD::MaxConnections);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to