Bug 124478 - Print number of file descriptors we have ...
Summary: Print number of file descriptors we have ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice Online
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0
Keywords: difficultyMedium, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2019-04-01 16:12 UTC by Michael Meeks
Modified: 2022-08-18 13:56 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2019-04-01 16:12:27 UTC
For very large Online instances we can be limited by the number of available file-descriptors.

We can fetch that with:

http://man7.org/linux/man-pages/man2/setrlimit.2.html

getrlimit - with RLIMIT_NOFILE

For each client that connects - we accept a new file-descriptor, and for each document we have another Kit process that we need to talk to down a file descriptor - we also have a wakeup pipe that is 2 file descriptors per socket poll.

So - we should divide this number by 4 to get a maximum number of documents that we can open - and then take off a few - eg. 8 (ie. 32 fds) for the basic console/output/and other polls we have around for things.

then we should print that number out in the logs at early startup - along with the maximum-FD - since we print a lot of #<fd> numbers in the logs.

Thanks !
Comment 1 codetronaut 2020-02-18 20:19:32 UTC
Hello, I would like to take this issue. 

for this issue, I thought in a way that:
in Linux we use $cat /proc/sys/fs/file-nr 
for the no. of file descriptors we have,

the method I found is:
 is to do something like looping over all possible descriptors (use getrlimit() to read RLIMIT_NOFILE to find the range) calling something like fcntl(fd, F_GETFD, 0) on each one and checking for EBADF responses to see which ones are not open.


If these are not appropriate please guide me on this.
Comment 2 codetronaut 2020-02-18 21:08:04 UTC Comment hidden (obsolete)
Comment 3 Commit Notification 2020-08-10 10:21:17 UTC
Gökhan Karabulut committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/online/commit/e2e638c468f35322fc123664fd749b199f531780

tdf#124478: Log maximum file descriptor related limits
Comment 4 Aron Budea 2020-08-14 06:46:44 UTC
Thanks for the patch, Gökhan! Can this bug report be closed?
Comment 5 Hossein 2022-08-18 13:56:05 UTC
Re-evaluating the EasyHack in 2022

This seems to be fixed by the above patch. The number of available file descriptors are now logged.