回答
收藏
分享
举报
Worker_rlimit_nofile指令不生效
提问于2020-10-29 11:58

浏览 5.1k

有没有遇到不生效的朋友,默认读取的还是系统设置。

已修改于2023-03-10 14:25



写下您的回答
发表回答
全部回答(3)

按点赞数排序

按时间排序

在配置多个监听器时,有报too many open files

1.是root用户启动的nginx

2.limits.conf中配置的1000000

3.nginx.conf中worker_rlimit_nofile 配置的655350,worker_processes配置的10,worker_connections配置的65535

赞同

1

回复举报

回答于2020-11-12 21:25



回复Omg
回复

你好Omg,直播中你提的问题,就是这个问题吗?我们互动解决下看看。你是看到too many open file错误了吗?

对于worker_rlimit_nofile指令,Nginx其实是调用Linux的setrlimit(RLIMIT_NOFILE, &rlmt)函数实现的,它与ulimit -n命令行相似,同时受制于2个条件:

1、所在用户组的句柄数。你是用root用户启动Nginx的吗?

2、/proc/sys/fs/nr_open系统级限制。这个值是多少?

持久化配置到文件/etc/security/limits.conf也是不错的。


赞同

1

回复举报

回答于2020-11-05 21:21



回复陶辉
回复
Omg回复了
在配置多个监听器时,有报too many open files 1.是root用户启动的nginx 2.limits.conf中配置的1000000,nr_open的值是1048576 3.nginx.conf中worker_rlimit_nofile 配置的655350,worker_processes配置的10,worker_connections配置的65535

0

回复举报

回答于2020-11-12 13:30



回复Omg
回复

或者必须在service文件中指定nofile

赞同

1

回复举报

回答于2020-10-29 11:58



回复Omg
回复
提问者
Omg
这家伙很懒还未留下介绍~
0
文章
1
问答
1
粉丝
相关问答

proxy_cache_valid用来匹配上游HTTP响应是否使用缓存的2个条件:

1、HTTP响应码,比如是否缓存404响应;

2、当上游响应中未携带cache-control、expires头部时,缓存将使用它后面的时间作为过期时间。

proxy_cache_path定义的淘汰时间,即到达后立刻删除,而过期时间只是资源过期,缓存不会立刻删除。 

点赞 0
浏览 3.8k
解决思路:
1:这里的signal 表示的是nginx的型号,找到对应25 对应的错误标签意思
signal各个数字含义
signal.h中是如下定义的: #include <machine/signal.h>/* sigcontext; codes for SIGILL, SIGFPE */ #defineSIGHUP 1/* hangup */ #defineSIGINT 2/* interrupt */ #defineSIGQUIT 3/* quit */ #defineSIGILL 4/* illegal instruction (not reset when caught) */ #defineSIGTRAP 5/* trace trap (not reset when caught) */ #defineSIGABRT 6/* abort() */ #if  (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) #defineSIGPOLL 7/* pollable event ([XSR] generated, not supported) */ #else/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #defineSIGIOT SIGABRT/* compatibility */ #defineSIGEMT 7/* EMT instruction */ #endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #defineSIGFPE 8/* floating point exception */ #defineSIGKILL 9/* kill (cannot be caught or ignored) */ #defineSIGBUS 10/* bus error */ #defineSIGSEGV 11/* segmentation violation */ #defineSIGSYS 12/* bad argument to system call */ #defineSIGPIPE 13/* write on a pipe with no one to read it */ #defineSIGALRM 14/* alarm clock */ #defineSIGTERM 15/* software termination signal from kill */ #defineSIGURG 16/* urgent condition on IO channel */ #defineSIGSTOP 17/* sendable stop signal not from tty */ #defineSIGTSTP 18/* stop signal from tty */ #defineSIGCONT 19/* continue a stopped process */ #defineSIGCHLD 20/* to parent on child stop or exit */ #defineSIGTTIN 21/* to readers pgrp upon background tty read */ #defineSIGTTOU 22/* like TTIN for output if (tp->t_local<OSTOP) */ #if  (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #defineSIGIO 23/* input/output possible signal */ #endif #defineSIGXCPU 24/* exceeded CPU time limit */ #defineSIGXFSZ 25/* exceeded file size limit */ #defineSIGVTALRM 26 /* virtual time alarm */ #defineSIGPROF 27/* profiling time alarm */ #if  (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define SIGWINCH 28/* window size changes */ #define SIGINFO29 /* information request */ #endif #define SIGUSR1 30/* user defined signal 1 */ #define SIGUSR2 31/* user defined signal 2 */ Exception codes In the crash log is a line that starts with the text Exception Codes: followed by one or more hexadecimal values. These are processor-specific codes that may give you more information on the nature of the crash. The exception code 0xbaaaaaad indicates that the log is a stackshot of the entire system, not a crash report. To take a stackshot, push the home button and any volume button. Often these logs are accidentally created by users, and do not indicate an error. The exception code 0xbad22222 indicates that a VoIP application has been terminated by iOS because it resumed too frequently. The exception code 0x8badf00d indicates that an application has been terminated by iOS because a watchdog timeout occurred. The application took too long to launch, terminate, or respond to system events. One common cause of this is doing synchronous networking on the main thread. Whatever operation is on Thread 0: needs to be moved to a background thread, or processed differently, so that it does not block the main thread. The exception code 0xc00010ff indicates the app was killed by the operating system in response to a thermal event. This may be due to an issue with the particular device that this crash occurred on, or the environment it was operated in. For tips on making your app run more efficiently, see iOS Performance and Power Optimization with Instruments WWDC session. The exception code 0xdead10cc indicates that an application has been terminated by iOS because it held on to a system resource (like the address book database) while running in the background. The exception code 0xdeadfa11 indicated that an application has been force quit by the user. Force quits occur when the user first holds down the On/Off button until "slide to power off" appears, then holds down the Home button. It's reasonable to assume that the user has done this because the application has become unresponsive, but it's not guaranteed - force quit will work on any application. Note: Terminating a suspended app by removing it from the multitasking tray does not generate a crash log. Once an app has suspended, it is eligible for termination by iOS at any time, so no crash log will be generated.
查看到 signal 25 表示的是exceeded file size limit 超出文件大小限制
通过排查是由于 access.log 文件太大,超过了 设置的最大值,删除文件并配置定时备份删除就可以了
点赞 0
浏览 5.2k

网络延迟,负载均衡,连接池都可能会有这种问题,如果是连接池耗尽,新请求就有可能会堆积并等待处理,导致数据丢失和混乱,调整一下大小就可以,或者是某部分后端服务器负载较重,而其他比较轻,也会导致请求堆积和数据混乱。

点赞 0
浏览 3.2k