Bug 266970 - net/nss-pam-ldapd: Very slow startup on machines with lots of RAM
Summary: net/nss-pam-ldapd: Very slow startup on machines with lots of RAM
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ryan Steinmetz
URL: https://github.com/arthurdejong/nss-p...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-11 15:14 UTC by Alan Somers
Modified: 2022-10-11 18:59 UTC (History)
1 user (show)

See Also:
zi: maintainer-feedback+


Attachments
Patches nslcd to use closefrom instead of close (3.27 KB, patch)
2022-10-11 15:14 UTC, Alan Somers
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2022-10-11 15:14:41 UTC
Created attachment 237216 [details]
Patches nslcd to use closefrom instead of close

nslcd tries to close all file descriptors on startup.  It does that by calling close() in a loop, running down from _SC_OPEN_MAX to 0.  Since _SC_OPEN_MAX autoscales with available RAM, this can take more than a minute on large servers.
The solution is to use closefrom.  Upstream has already made that change in the master branch, but due to its slow release cadence I suggest we apply the change in the ports tree as well.
Comment 1 Ryan Steinmetz freebsd_committer freebsd_triage 2022-10-11 15:35:43 UTC
Thanks for the submission!  Feel free to commit, approved by: maintainer.

If you would prefer not to commit, just let me know!
Comment 2 Alan Somers freebsd_committer freebsd_triage 2022-10-11 17:15:17 UTC
Ok, I'll commit!  But I have to fix it first.  It's failing in Poudriere, because something is triggering autoconf to rerun.  I need to figure that out first.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-10-11 18:50:07 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fe4dc1fd7105b8d28031f9fab5b1260fbd0bbcaa

commit fe4dc1fd7105b8d28031f9fab5b1260fbd0bbcaa
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2022-10-11 18:44:51 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2022-10-11 18:48:50 +0000

    net/nss-pam-ldapd: use closefrom in nslcd

    nslcd tries to close all file descriptors on startup.  It does that by
    calling close() in a loop, running down from _SC_OPEN_MAX to 0.  Since
    _SC_OPEN_MAX autoscales with available RAM, this can take more than a
    minute on large servers.  The solution is to use closefrom.  Upstream
    has already made that change in the master branch, but due to its slow
    release cadence we're applying it here as well.

    PR:             266970
    Approved by:    zi (maintainer)
    Sponsored by:   Axcient

 net/nss-pam-ldapd/Makefile                         |  1 +
 net/nss-pam-ldapd/files/patch-config.h.in (new)    | 12 ++++++++
 net/nss-pam-ldapd/files/patch-configure (new)      | 16 +++++++++++
 .../files/patch-nslcd_daemonize.c (new)            | 33 ++++++++++++++++++++++
 .../files/patch-nslcd_invalidator.c (new)          | 29 +++++++++++++++++++
 5 files changed, 91 insertions(+)