In case maximum number of open files limit is set too high, Pexec() spends way 
too much time trying to set FD_CLOEXEC for all those file descriptors, 
resulting in severe increase of time it takes to execute rpm or dnf. For 
example, this happens while running under Docker because:

> $ docker run fedora ulimit -n
> 1048576

One obvious fix is when open_max is too big, use procfs to get the actual list 
of opened file descriptors and iterate over those.

My quick-n-dirty benchmark shows the /proc approach is about 10x faster than 
iterating through a list of 1024 fds.

Note that this commit is rather conservative, meaning that the old code is used:
 - if open_max <= 1024;
 - if /proc is not available.

This should fix:
You can view, comment on, or merge this pull request online at:

-- Commit Summary --

  * luaext/Pexec: optimize setting CLOEXEC

-- File Changes --

    M luaext/lposix.c (60)

-- Patch Links --

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
Rpm-maint mailing list

Reply via email to