-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
OSError: [Errno 24] Too many open files #87
Comments
Got some recommendation from ChatGPT about the problem. Here are some steps and considerations specific to Streamlit:
@st.cache
def expensive_function():
# ... some code that opens files or connections
return result |
I faced a similar problem. Sometimes refreshing the page helps. Please tell me, could this be due to the large number of instances created? Instances are not running |
The problem gets solved once you restart Streamlit so one guess is that we are not closing the MQTT connections before making new one. In linux new connections are also treated as new files open. We should review the architecture. For example, if the app opens a new MQTT client connection each time in a loop without closing previous ones, this could rapidly exhaust file descriptors |
Is there any fix for this bug? I am facing an error when more than 5 to 6 instances are running at a time. |
the os has a limit on the number of files that can be opened both system wide and by a user at any given time. you can adjust this limit by modifying the limits in /etc/security/limits.conf to a higher value. run:
if these values already exist uncommented, modify the value in the fourth column, else add the following values to file:
this changes the per user limit on the number of open files in ubuntu and other systemd based systems. if you run into the same issue again, bump the value in the fourth column higher. |
it also might be worth reviewing the cause here too. im new to this repo but wondering if streamlit is improperly handling file closure. will keep an eye out as i deploy more bots. |
Describe the bug
OSError: [Errno 24] Too many open files: '/home/ubuntu/dashboard/pages/bot_orchestration/README.md' Traceback: File "/home/ubuntu/miniconda3/envs/dashboard/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script File "/home/ubuntu/dashboard/pages/bot_orchestration/app.py", line 24, in <module> File "/home/ubuntu/dashboard/utils/st_utils.py", line 23, in initialize_st_page File "/home/ubuntu/miniconda3/envs/dashboard/lib/python3.10/pathlib.py", line 1134, in read_text File "/home/ubuntu/miniconda3/envs/dashboard/lib/python3.10/pathlib.py", line 1119, in open
Hello everyone, so I am running 2 bot instances, and every few hours I get this error. I have to restart Streamlit every few hours. Tried rebooting the machine, too.
Steps to reproduce bug
sudo chmod 666 /var/run/docker.sock
The text was updated successfully, but these errors were encountered: