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

[interface] Too many open files in system (-23) #117

Open
joshschmelzle opened this issue Oct 19, 2022 · 0 comments
Open

[interface] Too many open files in system (-23) #117

joshschmelzle opened this issue Oct 19, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@joshschmelzle
Copy link
Member

In some scenarios, it is possible to hit the open file limit.

2022-10-18 23:39:16,355 [DEBUG] interface: command failed: Too many open files in system (-23)

I believe refactoring the run_command() code by using a context manager may fix this problem. Otherwise we may need to explicitly close file descriptors after opening them.

def run_command(cmd: list, suppress_output=False) -> str:
"""Run a single CLI command with subprocess and return stdout or stderr response"""
cp = subprocess.run(
cmd,
encoding="utf-8",
shell=False,
check=False,
capture_output=True,
)
if not suppress_output:
if cp.stdout:
return cp.stdout
if cp.stderr:
return cp.stderr

@joshschmelzle joshschmelzle self-assigned this Oct 27, 2022
@joshschmelzle joshschmelzle added the bug Something isn't working label Oct 27, 2022
@joshschmelzle joshschmelzle removed their assignment Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant