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

Performance issues when initiating a new PTY on systems with high FD limits #125

Closed
rphsoftware opened this issue Aug 29, 2022 · 3 comments

Comments

@rphsoftware
Copy link

When running on a system with a very high file descriptor limit, the library will take extreme amounts of time to initialize a new PTY properly. The culprit appears to be the following block of code:

pty4j/native/exec_pty.c

Lines 125 to 131 in 7bcaeb6

{
int fdlimit = sysconf(_SC_OPEN_MAX);
int fd = 3;
while (fd < fdlimit)
close(fd++);
}

A better solution on machines with the /proc filesystem available would be to perhaps try only closing file descriptors that are actually open?

@kprintf
Copy link

kprintf commented Aug 30, 2022

Related PR #124

@mbiebl
Copy link

mbiebl commented Jun 14, 2024

Should be fixed by #149

@segrey segrey closed this as completed in 04685d8 Jun 16, 2024
@segrey
Copy link
Collaborator

segrey commented Jun 17, 2024

Thank you for reporting and sorry for the delay. Should be fixed by 04685d8 and available since pty4j version 0.12.27.

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

4 participants