首页 > 解决方案 > 如何找出导致我系统上“pthread_create:资源暂时不可用”的原因?

问题描述

我在虚拟服务器上运行了一些 NodeJS api。过了一会儿,我可以 glib: Resource temporarily unavailable在尝试上传图像和pthread_create: Resource temporarily unavailable尝试在 bash 中运行某些命令时看到错误,例如npm list.

有没有办法找出究竟是什么导致了这个错误?例如,如果有一个进程打开了太多线程?top总共有 87 个线程的输出。它看起来也不像内存不足。

这是top -H输出:

top - 20:31:50 up 103 days,  7:28,  3 users,  load average: 0,03, 0,06, 0,13
Threads:  87 gesamt,   1 laufend,  86 schlafend,   0 gestoppt,   0 Zombie
%CPU(s):  0,8 be,  0,4 sy,  0,0 ni, 98,8 un,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
KiB Spch :  1048576 gesamt,   620896 frei,   206812 belegt,   220868 Puff/Cache
KiB Swap:        0 gesamt,        0 frei,        0 belegt.   841744 verfü Spch

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     ZEIT+ BEFEHL
28843 root      20   0   38532   3752   3124 R  0,7  0,4   0:00.49 top
 9059 root      20   0  617712  51512  28936 S  0,3  4,9   0:14.32 node
28570 root      20   0  952280  74920  40652 S  0,3  7,1   0:02.33 node
28577 root      20   0  951212  74604  40408 S  0,3  7,1   0:02.24 node
    1 root      20   0   77668   7836   6380 S  0,0  0,7   3:17.98 systemd
   80 root      20   0  260972  43000  32008 S  0,0  4,1  21:55.40 systemd-journal
  150 root      20   0   15736   1016    928 S  0,0  0,1   0:01.97 snapfuse
  152 root      20   0   42452   2708   2596 S  0,0  0,3   0:06.48 systemd-udevd
  153 systemd+  20   0   71872   3256   3256 S  0,0  0,3   0:08.25 systemd-network
  166 syslog    20   0  189016   4280   3192 S  0,0  0,4   0:00.38 rsyslogd
  184 syslog    20   0  189016   4280   3192 S  0,0  0,4   2:05.12 in:imuxsock
  185 syslog    20   0  189016   4280   3192 S  0,0  0,4   1:28.25 rs:main Q:Reg
  167 message+  20   0   47776   3932   3432 S  0,0  0,4   0:02.83 dbus-daemon
  177 root      20   0   62140   4804   4712 S  0,0  0,5   0:09.90 systemd-logind
  179 root      20   0   30016   2640   2560 S  0,0  0,3   0:12.12 cron
  229 root      20   0  100968   1876   1872 S  0,0  0,2   0:00.00 saslauthd
  231 root      20   0  100968      4      0 S  0,0  0,0   0:00.00 saslauthd
  383 root      20   0  185956   7788   7788 S  0,0  0,7   0:00.07 unattended-upgr
  432 root      20   0  185956   7788   7788 S  0,0  0,7   0:00.00 gmain
  397 root      20   0   72288   5736   5596 S  0,0  0,5  12:18.69 sshd
  425 root      20   0   24176   2200   2196 S  0,0  0,2   0:00.00 xinetd
  621 root      20   0   67368   3652   3520 S  0,0  0,3   0:19.57 master
  623 postfix   20   0   69468   4776   4672 S  0,0  0,5   0:03.81 qmgr
 7921 root      20   0   97360   7140   6036 S  0,0  0,7   0:00.47 sshd
 7936 root      20   0   20480   3924   3368 S  0,0  0,4   0:00.19 bash
 9060 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.00 node
 9061 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.10 node
 9062 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.08 node
 9063 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.07 node
 9064 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.07 node
 9065 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.00 node
 9066 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.02 node
 9067 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.02 node
 9068 root      20   0  617712  51512  28936 S  0,0  4,9   0:00.02 node

标签: node.jslinux

解决方案


推荐阅读