MAC下mongo db報too many open files

7077 ワード

mongodbはmacシステムの下で、テスト中にこのエラーをよく報告し、次にmongoデータベースがクラッシュする場合があります.
mongodbを起動すると警告が表示されます
** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000

誤報
Listener: accept() returns -1 errno:24 Too many open files
2016-12-07T11:14:31.911+0800 E NETWORK  [initandlisten] Out of file descriptors. Waiting one second before trying to accept more connections.

クラッシュ
mongod(_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE+0x3A) [0x10bfdaeaa]
 mongod(_ZN5mongo10logContextEPKc+0x171) [0x10bf762e1]
 mongod(_ZN5mongo17invariantOKFailedEPKcRKNS_6StatusES1_j+0x1CA) [0x10bf6468a]
 mongod(_ZN5mongo17WiredTigerSession9getCursorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEyb+0xE4) [0x10bd7ee14]
 mongod(_ZN5mongo16WiredTigerCursorC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEybPNS_16OperationContextE+0x5F) [0x10bd7e4cf]
 mongod(_ZN5mongo15WiredTigerIndex6insertEPNS_16OperationContextERKNS_7BSONObjERKNS_8RecordIdEb+0x81) [0x10bd60271]
 mongod(_ZN5mongo17IndexAccessMethod6insertEPNS_16OperationContextERKNS_7BSONObjERKNS_8RecordIdERKNS_19InsertDeleteOptionsEPx+0xC4) [0x10b988014]
 mongod(_ZN5mongo12IndexCatalog21_indexFilteredRecordsEPNS_16OperationContextEPNS_17IndexCatalogEntryERKNSt3__16vectorINS_10BsonRecordENS5_9allocatorIS7_EEEE+0xAB) [0x10b7d972b]
 mongod(_ZN5mongo12IndexCatalog13_indexRecordsEPNS_16OperationContextEPNS_17IndexCatalogEntryERKNSt3__16vectorINS_10BsonRecordENS5_9allocatorIS7_EEEE+0x105) [0x10b7d98a5]
 mongod(_ZN5mongo12IndexCatalog12indexRecordsEPNS_16OperationContextERKNSt3__16vectorINS_10BsonRecordENS3_9allocatorIS5_EEEE+0x4D) [0x10b7d9cdd]
 mongod(_ZN5mongo10Collection16_insertDocumentsEPNS_16OperationContextENSt3__111__wrap_iterIPKNS_7BSONObjEEES8_b+0x325) [0x10b7b37c5]
 mongod(_ZN5mongo10Collection15insertDocumentsEPNS_16OperationContextENSt3__111__wrap_iterIPKNS_7BSONObjEEES8_bb+0x111) [0x10b7b31b1]
 mongod(_ZN5mongo10Collection14insertDocumentEPNS_16OperationContextERKNS_7BSONObjEbb+0x5B) [0x10b7b39fb]
 mongod(_ZN5mongo11UpdateStage8doInsertEv+0x347) [0x10b910e97]
 mongod(_ZN5mongo11UpdateStage4workEPm+0x123) [0x10b9112b3]
 mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0x3D1) [0x10bb17af1]
 mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x39) [0x10bb17689]
 mongod(_ZN5mongo12PlanExecutor11executePlanEv+0x61) [0x10bb186a1]
 mongod(_ZN5mongo14receivedUpdateEPNS_16OperationContextERKNS_15NamespaceStringERNS_7MessageERNS_5CurOpE+0x621) [0x10b9a7ee1]
 mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x2923) [0x10b9a2333]
 mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE+0xEA) [0x10b68f24a]
 mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x2D4) [0x10bf82a64]
 mongod(_ZNSt3__114__thread_proxyINS_5tupleIJNS_6__bindIPFPvS3_EJPN5mongo12_GLOBAL__N_124MessagingPortWithHandlerEEEEEEEEES3_S3_+0x61) [0x10bf82081]
 libsystem_pthread.dylib(_pthread_body+0xB4) [0x7fffacb91aab]
 libsystem_pthread.dylib(_pthread_body+0x0) [0x7fffacb919f7]
 libsystem_pthread.dylib(thread_start+0xD) [0x7fffacb91221]
-----  END BACKTRACE  -----
2016-12-07T11:14:45.501+0800 I -        [conn129] 

***aborting after invariant() failure

解決策は簡単だ
ulimit -n 10000 

すぐ