问题解决:bash: fork: retry: Resource temporarily unavailable
1.参考其它帖子,limit.conf里进程数文件数等已经设置得很大,但是问题依然存在
2.用脚本不断创建线程发现ps -eLf|wc -l 到达10800就会到达瓶颈然后报错
(参考文章 https://www.tutorialfor.com/questions-314508.htm )
用于复现问题的脚本
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
void *threadRun(void *arg)
{
sleep(60 * 3);
}
int main()
{
int num = 0;
pthread_t tid;
while (pthread_create(&tid, NULL, threadRun, NULL) == 0)
printf("create thread(%llu) %d OK.\n", tid, ++num);
sleep(60 * 3);
return 0;
}
gcc -o main main.c -lpthread
./main
3.查看发现系统得任务数最大值
4.修改
5.重新加载系统配置