- 論壇徽章:
- 0
|
我們在測試時發(fā)現(xiàn)日志中創(chuàng)建線程報錯:Resource temporarily unavailable(errno = 11, EAGAIN)
但是用limit查看資源很充足,物理內(nèi)存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
我的問題是:怎么查找是什么資源導(dǎo)致某次調(diào)用失敗。
我寫了一個簡單的測試程序,一直創(chuàng)建線程,然后用systemstap檢測,檢測腳本是- probe kernel.function("SyS_clone").return
- {
- if ($return != 0)
- {
- print_backtrace();
- exit();
- }
- }
復(fù)制代碼 得出的結(jié)果是:
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;
- }
復(fù)制代碼 |
|