Mongodb – Why MongoDB collections are dropped automatically

mongodb

I have installed mongodb 3.6 standalone instance and created some collections through insert query in mongo shell. My app points to the db server, the app creates some new collections, it reads, writes and so on. This is running for more than two months. If we restart the instance we can see in mongodb collections which are created through insert query are lost. Now we can see the same behavior in other environments. Also, while analyzing this problem, we found that during mongodb server start there was a error saying "mongodb failed to create WiredTiger bulk cursor: Device or resource busy". Any idea what that error line implies?

The below messges are found in mongodb log file during server shutdown

**2018-08-28T12:44:46.138+0530 I CONTROL [signalProcessingThread] got signal 1 (Hangup), will terminate after current cmd ends**

**2018-08-28T12:44:46.138+0530 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...**

**2018-08-28T12:44:46.138+0530 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock**

**2018-08-28T12:44:46.152+0530 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture**

**2018-08-28T12:44:46.158+0530 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down**

**2018-08-28T12:44:46.265+0530 I STORAGE [signalProcessingThread] shutdown: removing fs lock...**

**2018-08-28T12:44:46.265+0530 I CONTROL [signalProcessingThread] now exiting**

**2018-08-28T12:44:46.266+0530 I CONTROL [signalProcessingThread] shutting down with code:0**

And during server startup the below messages are found in the log file,

**2018-08-28T14:19:39.256+0530 I STORAGE [thread2] createCollection: config.system.sessions with generated UUID: e981a966-4f87-45a9-9adb-6b7e2fdb8803**

**2018-08-28T14:19:39.277+0530 I INDEX [thread2] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }**

**2018-08-28T14:19:39.277+0530 I INDEX [thread2] building index using bulk method; build may temporarily use up to 500 megabytes of RAM**

**2018-08-28T14:19:39.278+0530 W STORAGE [thread2] failed to create WiredTiger bulk cursor: Device or resource busy**

**2018-08-28T14:19:39.278+0530 W STORAGE [thread2] falling back to non-bulk cursor for index table:index-12--7471022903774062594**

**2018-08-28T14:19:39.278+0530 I INDEX [thread2] build index done. scanned 0 total records. 0 secs**

Best Answer

I have gone through your error log and find out the MongoDB Bug affected version error , which are able to see in your error log such as:

"mongodb failed to create WiredTiger bulk cursor: Device or resource busy"

As per MongoDB jira documentation here as it is Server Bug having affected version was 2.8.0-rc0.

The Bug fix version of MongoDB is 2.8.0-rc1.

And the second Bug error, which is

2018-08-28T12:44:46.138+0530 I CONTROL [signalProcessingThread] got signal 1 (Hangup), will terminate after current cmd ends

As jira documentation here It's affected Bug in MongoDB version 3.0.12.

As per @RamonFernandez from jira documentation, seems like mongod is receiving the SIGHUP signal and terminating, which is expected behavior. You need to check who or what is sending this signal.