首页 > 其他分享 >OSError: [Errno 24] Too many open files

OSError: [Errno 24] Too many open files

时间:2023-03-27 19:22:34浏览次数:45  
标签:24 files OSError envs py xiaojie File home line

  1. 现象
    在用 jmeter 对 Django 的服务进行压力测试的时候,当并发量上到一定的数量时(我压测的时候用了1000),服务器进程崩了,并报了错:

Traceback (most recent call last):
File "manage.py", line 21, in
File "manage.py", line 17, in main
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/init.py", line 381, in execute_from_command_line
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/init.py", line 375, in execute
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 60, in execute
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 95, in handle
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 102, in run
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 585, in run_with_reloader
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 570, in start_django
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 288, in run
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 294, in run_loop
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 334, in tick
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 350, in snapshot_files
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/utils/autoreload.py", line 254, in watched_files
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/pathlib.py", line 1102, in glob
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/pathlib.py", line 562, in _select_from
File "/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/pathlib.py", line 519, in _select_from
OSError: [Errno 24] Too many open files: '/home/xiaojie/.conda/envs/xiaojie/lib/python3.7/site-packages/django/contrib/admin/locale'
2. 问题
经过搜索查找,是系统层面上的报错,服务器的 Linux 系统同时打开的文件数有限制。

This is a system-level thing - you need to increase your ulimit for file handles (it's likely a small change in that patch version resulted in more file handles). I can't give instructions here for every OS, but if you search for ulimit file handles and your OS name you should find instructions on how to raise it.
3. 解决
更改系统配置

Check current limit

$ ulimit -n
256

Raise limit to 2048

$ ulimit -n 2048

标签:24,files,OSError,envs,py,xiaojie,File,home,line
From: https://www.cnblogs.com/guowenrui/p/17262576.html

相关文章

  • FileSaver 下载 base64 excel,
    以下是一个示例,演示如何使用FileSaver将base64编码的Excel文件保存到本地:yarnaddfile-saver-dimport*asFileSaverfrom'file-saver';//将base64编码的......
  • git解决error: The following untracked working tree files would be overwritten by
    在IDEA中进行分支切换时,出现如此错误,导致无法正常切换:error:Thefollowinguntrackedworkingtreefileswouldbeoverwrittenbycheckout通过错误提示可知,是由于一些un......
  • AcWing1024 -- 记忆化搜索 & 天梯赛
    1.题目描述2022年天梯赛正赛\(DIV2\)2.思路首先认真读题,题目说的是每次送完外卖之后不必返回起点。另外,需要送外卖的点是逐个添加,每添加一次都要算一次最短路......
  • 【2023-03-24】主次分明
    20:00乐观的作用是无法估量的,只要你怀揣着对未来的积极信念,你一定可以过得更幸福。                          ......
  • 2023.03.24总结
    题目1:abc239_f题意有\(n\)个点,\(m\)条无向边,现在要再建\(n-m-1\)条边,使整个图连通且第\(i\)个点的度数为\(d_i(1\lei\len)\)。请确定是否有这样的建造......
  • 每日总结2023/3/24
                 ......
  • 2024考研408Week2
    一、本周总结:使用时间:(目标45h,未达到)总计20h27min,数学9h2min,专业课2h,英语9h25min.去省行交流的第一周自己有点浮躁,学习效率甚至不如上一周,需要调整。二、存在问题:1.数学、......
  • 关于python中的OSError报错问题
    Traceback(mostrecentcalllast): File"main.py",line1,in<module>   fromtrainerimportTrainer File"/home/visionx/mt/qg/paragraph_nqg_max_point_......
  • AtCoder Beginner Contest 248 F(连通性状压dp)
    F连通性状压dp思路看了dls的讲解后才明白一点点。状态\(dp[i][j][k]\)表示到表示到i列,删除了j条边,点i和n-1+i是否联通,对于下一列点,若当前i和n-1+i连通,则多出来的三条......
  • 24. 两两交换链表中的节点——学习笔记
    题目:给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题(即,只能进行节点交换)。示例1:输入:head=[1,2,3,4]输......