- 论坛徽章:
- 0
|
我们在测试时发现日志中创建线程报错:Resource temporarily unavailable(errno = 11, EAGAIN)
但是用limit查看资源很充足,物理内存2T
[####]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16543461
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 500000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 42768
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
我的问题是:怎么查找是什么资源导致某次调用失败。
我写了一个简单的测试程序,一直创建线程,然后用systemstap检测,检测脚本是- probe kernel.function("SyS_clone").return
- {
- if ($return != 0)
- {
- print_backtrace();
- exit();
- }
- }
复制代码 得出的结果是:
Returning from: 0xffffffff81066bd0 : SyS_clone+0x0/0x20 [kernel]
Returning to : 0xffffffff8172c9c9 : stub_clone+0x69/0x90 [kernel]
可惜什么都看不懂,请大侠们指点一下。
测试程序:- #include <sys/types.h>
- #include <sys/wait.h>
- #include <sys/stat.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <spawn.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- #include <errno.h>
- #include <dirent.h>
- #include <pthread.h>
- #include <iostream>
- #include <string>
- using namespace std;
- void *func(void *)
- {
- while (true)
- sleep(10);
- return NULL;
- }
- int main(int argc, char **argv)
- {
- pthread_t tid;
- int ret = 0;
- int count = 0;
- while (!ret)
- {
- ret = pthread_create(&tid, NULL, func, NULL);
- count ++;
- }
- count--;
- printf("max thread is : %d, errno is %d\n", count, ret);
- return EXIT_SUCCESS;
- }
复制代码 |
|