Answer the question
In order to leave comments, you need to log in
/bin/bash: Too many open files in system. If you do not reboot the server, will it pass after some time? How to avoid?
I understand my mistakes, but I can not find a method to avoid the server hanging.
I ran a file processing script through python:
Example like this:
import subprocess
for i in files:
subprocess.run(<скрипт>)
Too many open files in system..
Answer the question
In order to leave comments, you need to log in
Limit the number of child processes
max_child_processes = 100
child_processes = []
for i, row in df.iterrows():
while len(child_processes ) >= max_child_processes:
sleep(0.1)
child_processes = [p for p in child_processes if p.poll() is None]
path = row.path
subp = subprocess.Popen(f"echo {password} | sudo -S ./recog_wav.sh {path}",
stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
child_processes.appen(subp)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question