在观摩了一个关于性能问题排查的PPT之后试着用lsof命令来列举linux系统打开的文件,
然后发现出现了很多“ can't identify protocol ” 的信息:
udevd 3117 root 989u sock 0,4 84579 can't identify protocol
udevd 3117 root 990u sock 0,4 84632 can't identify protocol
udevd 3117 root 991u sock 0,4 84757 can't identify protocol
udevd 3117 root 992u sock 0,4 84836 can't identify protocol
udevd 3117 root 993u sock 0,4 84899 can't identify protocol
udevd 3117 root 994u sock 0,4 85018 can't identify protocol
udevd 3117 root 995u sock 0,4 85135 can't identify protocol
udevd 3117 root 996u sock 0,4 85172 can't identify protocol
udevd 3117 root 997u sock 0,4 85213 can't identify protocol
udevd 3117 root 998u sock 0,4 85318 can't identify protocol
可以看到这都是由于3117进程打印出来的,于是使用strace命令追中该进程号:
[root@localhost ~]# strace -p 3117
Process 3117 attached - interrupt to quit
select(0, [], [], NULL, {0, 168000}) = 0 (Timeout)
time([1349686960]) = 1349686960
select(0, [], [], NULL, {1, 0}) = 0 (Timeout)
time([1349686961]) = 1349686961
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = -1 EMFILE (Too many open files)
select(0, [], [], NULL, {1, 0}) = 0 (Timeout)
time([1349686962]) = 1349686962
select(0, [], [], NULL, {1, 0}) = 0 (Timeout)
time([1349686963]) = 1349686963
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = -1 EMFILE (Too many open files)
select(0, [], [], NULL, {1, 0}) = 0 (Timeout)
time([1349686964]) = 1349686964
select(0, [], [], NULL, {1, 0}) = 0 (Timeout)
time([1349686965]) = 1349686965
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = -1 EMFILE (Too many open files)
于是追踪到“Too many open files”错误。
到这里,就很明白了,是进程打开文件句柄的个数达到了linux的限制。
而这种限制分为系统层面的和用户层面的:
系统层面的在:/proc/sys/fs/file-max里设置
[root@localhost ~]# cat /proc/sys/fs/file-max
1602508
用户层面的限制在:/etc/security/limits.conf里设定
使用 ulimit -a 查看系统允许单个进程打开的最大文件数:
[root@localhost ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
pending signals (-i) 1024
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 278528
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
注意“open files (-n) 1024” 这一行,系统只允许每个非root用户(运行不是系统级别的程序一般都是非root用户来启动的)打开1024个文件。
既然问题找到,那就只要把这个值改大就好了,可以使用这两种方法:
1、临时修改
· ulimit -n 131072(重启无效)
· 在/etc/rc/rc.local里加入ulimit -n 131072
2、永久修改
在/etc/security/limits.conf文件里加入以下内容,重启生效:
* soft nofile 131072
* hard nofile 131072
你也可以零时修改和永久修改一起进行,这样重启系统之后还能保持一样的open files限制。
—— EOF ——
分享到:
相关推荐
This specification document will build on the USB defined specification and identify the protocol, procedures and features for simple input devices to talk HID over I2C. This specific document will ...
Laravel开发-identify Laravel 5软件包提供商,用于识别/检测用户的浏览器、设备、操作系统和语言。
25network protocol in your own code so you can test the protocol’s behavior to find security weaknesses. Chapter 9: The Root Causes of Vulnerabilities This chapter describes common security ...
libero-Identify详细教程-actel
Different group owner have different key , so it can identify the owner of tag. In this paper, K1 represent a new owner. ID The unique identifier of tag ; Rt The random number generate by tag ; Rr ...
自己动手实现Arcmap中的Identify功能 自己动手实现Arcmap中的Identify功能 自己动手实现Arcmap中的Identify功能 自己动手实现Arcmap中的Identify功能
内部自带一个属性查看窗口,使用树结构对当前位置下所有图层对应的元素信息进行展示。需要修改的部分:缓冲区域范围。
AE+C#Identify功能实现.pdf
资源分类:Python库 所属语言:Python 资源全名:identify-1.5.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
OCR 身份证识别 ...打开百度云,创建应用,得到 AppKey secretKey,根据提示下载 jar 包和 lib 包,并放到项目中 Step 4. 初始化 OCR.getInstance().initAccessTokenWithAkSk(new OnResultListener
主要介绍了解决idea 拉取代码出现的 “ Сannot Run Git Cannot identify version of git executable: no response“的问题,需要的朋友可以参考下
ArcEngine identify founction
Anaconda+Jupyter+Opencv:用于识别输入图像中的物体,属于有监督学习。
definition and is used by the host to properly identify a communication device that may present several different types of interfaces. The Communication Interface Class defines a general-purpose ...
采用了PDG(程序依赖图)和一个叫Codesurfer的软件。 可以识别交织的重复代码,生成新的函数。 本文具有很好的启发价值。 Programs often have a lot of duplicated code, which makes both understanding and ...
how to identify,develop,deploy,and connect talents when companies transform to global integrated enterprise the case of advantech
使用idenfity获取图片的垂直分辨率和水平分辨率,在 ImageMagick 中,`identify` 是一个命令行工具,用于获取图像文件的信息和属性。通过运行 `identify` 命令,您可以查看图像文件的各种属性,如尺寸、颜色深度、...
arcgis engine开发identify程序
colour_identify.ino
level_identify.py