Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current maximum number of open files not set high enough #157

Open
watson6282 opened this issue May 6, 2024 · 1 comment
Open

Current maximum number of open files not set high enough #157

watson6282 opened this issue May 6, 2024 · 1 comment

Comments

@watson6282
Copy link

The current maximum number of open files (RLIMIT_NOFILE) is not being set high enough. In some cases, certain combinations of the fanout and the current open file limit leads to pdsh dumping core after reaching its maximum number of open files. This code:

int nfds = (2 * opt->fanout) + 32;

does end up setting enough file descriptors in a case like this (ssh rcmd, 1024 max files, 300 fanout):

quartz187 ~/pie# ulimit -Sn 1024; strace -e prlimit64 -o strace.out pdsh -f 300 -w "equartz[1-300]" echo > /dev/null; echo; cat strace.out
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: exec cmd ssh failed for host equartz242
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: exec cmd ssh failed for host equartz299
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: exec cmd ssh failed for host equartz38
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
pdsh@quartz187: pipecmd: socketpair: Too many open files
Segmentation fault

prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=125*1024}) = 0
+++ killed by SIGSEGV (core dumped) +++
@grondo
Copy link
Member

grondo commented May 6, 2024

The 2*fanout estimate possibly only applies to the rcmd implementation and not exec (it could be 4*fanout here because there's potentially a socketpair(2) call for both stdin/out and stderr). Perhaps all that is required here is to increase the multiplier to 4 (and fix the segfault of course).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants