现在的位置: 首页 > 综合 > 正文

mongodb 2.2.0 bug —— can’t create new thread, closing connection

2014年02月20日 ⁄ 综合 ⁄ 共 1220字 ⁄ 字号 评论关闭

原文链接:http://blog.csdn.net/ylqmf/article/details/8114582

客户端反映用户连接偶尔失败,查询日志得到如下信息:

Fri Oct 26 11:15:35 [initandlisten] connection accepted from 10.100.2.xx:9811 #3441 (92 connections now open)
Fri Oct 26 11:15:35 [conn3441]  authenticate db: db { authenticate: 1, user: "user", nonce: "4c2bfc363cc7dafa", key: "a08f451f169cc7aa9d7dafb6bdf084fb" }
Fri Oct 26 11:15:35 [initandlisten] connection accepted from 10.100.2.xx:9812 #3442 (93 connections now open)
Fri Oct 26 11:15:35 [initandlisten] pthread_create failed: errno:11 Resource temporarily unavailable
Fri Oct 26 11:15:35 [initandlisten] can't create new thread, closing connection
Fri Oct 26 11:15:35 [initandlisten] connection accepted from 10.100.2.xx:9813 #3443 (93 connections now open)
Fri Oct 26 11:15:35 [initandlisten] pthread_create failed: errno:11 Resource temporarily unavailable
Fri Oct 26 11:15:35 [initandlisten] can't create new thread, closing connection
Fri Oct 26 11:15:35 [conn3441] end connection 10.100.2.xx:9811 (91 connections now open)


查询 ulimit -u 发现只有1024.每个用户只能创建1024个进程。因为linux下thread是用process来实现的,所以多进程被限制在1024以内。

修改 ulimit -u 65535 后,问题解决

不过mongo创建如此多的线程不能即使释放是由php-mongo的客户端bug,mongo 客户端driver 需 升级到1.2.x版本以上才能从根本上解决问题。

#今天研发同学发现一个问题,想某张表中写入数据报错

can't map file memory

检查了该表所在的数据文件,发现所属用户竟然是root。chown mongodb后一切正常。


原文链接:http://blog.csdn.net/ylqmf/article/details/8114582

抱歉!评论已关闭.