mongodb:pthread_create失败:错误:11

时间:2015-02-12 12:52:40

标签: mongodb ulimit

我想在我的vServer(CentOS 6)上运行sharelatex。我安装了所有东西,但是sharelatex不会开始。 mongod.log在接受了一些联系之后说:

2015-02-12T12:04:30.971+0100 [initandlisten] pthread_create failed: errno:11 Resource temporarily unavailable
2015-02-12T12:04:30.971+0100 [initandlisten] can't create new thread, closing connection

我已经增加了ulimits:

[root@vServer]# ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 256270
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 21000
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) 256270
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

任何人都可以帮助我吗?

编辑: 我还检查了mongod过程的限制:

[root@vServer]# cat //proc/552/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            10485760             unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             62848                62848                  processes
Max open files            21000                21000                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       256270               256270               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0      
Max realtime timeout      unlimited            unlimited            us

EDIT2:

这是ulimit的输出:

[root@vServer]# ulimit -Sa
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 256270
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 21000
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) 256270
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

[root@vServer]# ulimit -Ha
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 256270
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 21000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 256270
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

但是你可以看到我以root身份登录。难道不能显示cat // proc / 552 /限制过程的实际限制吗?

1 个答案:

答案 0 :(得分:2)

我遇到了mongodb的/proc/sys/vm/max_map_count内核参数问题。基本上mongodb试图分配超过65k的内存映射,这是库存内核限制。

遇到此问题时,错误与您发布的涉及pthread_create失败的错误相同。要修复它,我只是以root身份执行以下操作:

echo 2048000 > /proc/sys/vm/max_map_count

无论这是否有效,我强烈建议在mongodb pid上使用strace来尝试查看它失败的位置。我认为您看到的错误消息并不一定会引导您朝着正确的方向前进。