Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
closefrom performance improvement by using dirfd #1757
Comments
|
Hmm.. that's depressing. I've pushed changes which might help. Does RH6 have i.e. do |
gmachin
commented
Sep 26, 2016
|
No I don’t see F_MAXFD or F_CLOSEM in the fcntl on RH6 or RH7. I am running an older version of freeradius 2.2.5, but saw 2.2.9 used the same function, and wanted for you to know what I found. Even changing maxfd to 1024 had significant impact, however using dirfd and closing only open fds > 3 had the best results. I first tried closing all fd > 3 until I got a -1 and EBADF errno. That worked as well but that assumed all open fds were sequential and there were no gaps. I saw other versions of closefrom using dirfd and that appeared to be a better solution. Glenn From: Alan DeKok notifications@github.com Hmm.. that's depressing. closefrom() has bene around for a LONG time. I've pushed changes which might help. Does RH6 have F_MAXFD or F_CLOSEM? i.e. do man fcntl, and look for those names. — |
alandekok
added a commit
that referenced
this issue
Sep 26, 2016
|
|
alandekok |
9f02ac8
|
|
I've pushed a fix. Please verify, as we're trying to release 3.0.12 today or tomorrow. |
alandekok
closed this
in 75a48b7
Sep 26, 2016
|
I've pushed fixes after some checks. They also improve closefrom() performance on OSX. |
gmachin commentedSep 25, 2016
Issue type Feature request.
Redhat 6 does not have the closefrom system call and using the closefrom in lib/misc.c
The maximum fd for many systems is > 8000 fd. Only a small percentage are open fd and need to closed. The closing of the fd causes significant performance loss if peap/mschapv2 and ntlm_auth is used will cause threads to hang and force children to be killed. Analysis indicated the system was spending to much time in the closefrom function. The fix was to utilize dirfd to only close open fd. Below is the modified closefrom code:
ifndef HAVE_CLOSEFROM
int closefrom(int lowfd)
{
int i;
int maxfd = 256;
ifdef HAVE_DIRFD
endif
ifdef _SC_OPEN_MAX
endif
ifdef HAVE_DIRFD
endif /* HAVE_DIRFD */
}
endif