Dealing with large datasets with frequent updates cause data corruption

Hi,

I am writing a web application which requires mongodb to deal with huge datasets (up to and more than 100K documents per collection).

While the web app runs, every hour, it does some updates on the database by inserting new records. Today I woke up and I saw that my database got corrupted and not even the mongod --dbpath data repair worked to fix my database, so I had to get rid of the database.

Luckily I had made a backup but seeing data corruption every now and then is very frustrating.

Any ideas on how to safely deal with large datasets and updates with mongodb and prevent any possible data corruption from occurring?

Hi @George_K welcome to the community.

The WiredTiger storage engine (default from MongoDB 3.2 series) is very conservative in handling data, that typically the cause of a corruption is faulty hardware.

Could you elaborate on what you’re seeing:

  • What error message that tells you that there is corruption? Could you post the actual message?
  • What is your MongoDB version?
  • How did you install MongoDB? Is this in a VM, Docker image, or bare metal?

Best regards,
Kevin

Hi Kevin,

I use WiredTiger and after days of inspections, I realised that MongoDB uses a lot of RAM. I had to upgrade my server from 1GB to 4GB ram (Ubuntu 19.02).

The thing is that when I reboot my server, there is roughly 3GB free of RAM and after a few days it drops to around 500MB.


This is very frustrating as my budget is very low and I cannot keep increasing the RAM. I was wondering if there is any other way either limit the RAM usage or keep freeing RAM automatically periodically so my application doesn’t end up crashing or the server becomes completely unresponsive.

My MongoDB version is now 4.4.0. I use node.js to deploy my web-app. I don’t have a screenshot of the error, but as I remember it was displaying a series of 0’s (8 bits 0000000x0) and hexadecimals.

How could I prevent this issue from happening?

Hi @George_K,

It is normal for Linux to try to use available RAM for file caching. See Linux ate my RAM! for more context.

With your current output, you have 996MB available (used, but can be made available for applications if needed) of which 568MB is free (not currently used). If you aren’t seeing any memory-related issues (for example, failed allocations or performance challenges), you probably have ample memory at the moment.

By default MongoDB allocates the larger of 50% of (RAM - 1 GB), or 256 MB for the WiredTiger cache. The WiredTiger cache is used for reading and writing data in MongoDB. Memory outside the WiredTiger cache is used for temporary allocations (connections, aggregation, JavaScript evaluation, …) and by the operating system for caching files.

With your original 1GB of RAM, the WiredTiger cache would be 256MB. With 4GB of RAM, the WiredTiger cache will (by default) use 1.5GB of RAM ( 0.5 * (4 GB - 1 GB) = 1.5 GB ).

Regards,
Stennie

1 Like

Hi @Stennie_X

Make sense, but what can I do to prevent causing memory leaks? I need to occasionally reboot my server which could cause my data to be corrupted for some reason. Here is for example my most recent corruption occured:

    root@me:/var/www/website.com# mongod --dbpath /data/db/
{"t":{"$date":"2020-09-15T16:40:39.616+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-09-15T16:40:39.628+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-09-15T16:40:39.628+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2020-09-15T16:40:39.629+00:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1133,"port":27017,"dbPath":"/data/db/","architecture":"64-bit","host":"me"}}
{"t":{"$date":"2020-09-15T16:40:39.629+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","openSSLVersion":"OpenSSL 1.1.1c  28 May 2019","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-09-15T16:40:39.629+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"19.10"}}}
{"t":{"$date":"2020-09-15T16:40:39.629+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"storage":{"dbPath":"/data/db/"}}}}
{"t":{"$date":"2020-09-15T16:40:39.631+00:00"},"s":"I",  "c":"STORAGE",  "id":22270,   "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db/","storageEngine":"wiredTiger"}}
{"t":{"$date":"2020-09-15T16:40:39.631+00:00"},"s":"I",  "c":"STORAGE",  "id":22297,   "ctx":"initandlisten","msg":"Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem","tags":["startupWarnings"]}
{"t":{"$date":"2020-09-15T16:40:39.631+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=1456M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
{"t":{"$date":"2020-09-15T16:40:40.392+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:392279][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 20 through 21"}}
{"t":{"$date":"2020-09-15T16:40:40.503+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:503357][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 21 through 21"}}
{"t":{"$date":"2020-09-15T16:40:40.615+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:615158][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Main recovery loop: starting at 20/7936 to 21/256"}}
{"t":{"$date":"2020-09-15T16:40:40.733+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:733600][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Creating the history store before applying log records. Likely recovering after anunclean shutdown on an earlier version"}}
{"t":{"$date":"2020-09-15T16:40:40.739+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:739499][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 20 through 21"}}
{"t":{"$date":"2020-09-15T16:40:40.804+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:804151][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 21 through 21"}}
{"t":{"$date":"2020-09-15T16:40:40.857+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1600188040:857836][1133:0x7f7b85cce440], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global recovery timestamp: (0, 0)"}}
{"t":{"$date":"2020-09-15T16:40:40.867+00:00"},"s":"I",  "c":"STORAGE",  "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":1236}}
{"t":{"$date":"2020-09-15T16:40:40.867+00:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
{"t":{"$date":"2020-09-15T16:40:40.885+00:00"},"s":"I",  "c":"STORAGE",  "id":22262,   "ctx":"initandlisten","msg":"Timestamp monitor starting"}
{"t":{"$date":"2020-09-15T16:40:40.887+00:00"},"s":"W",  "c":"CONTROL",  "id":22120,   "ctx":"initandlisten","msg":"Access control is not enabled for the database. Read and write access to data and configuration is unrestricted","tags":["startupWarnings"]}
{"t":{"$date":"2020-09-15T16:40:40.887+00:00"},"s":"W",  "c":"CONTROL",  "id":22138,   "ctx":"initandlisten","msg":"You are running this process as the root user, which is not recommended","tags":["startupWarnings"]}
{"t":{"$date":"2020-09-15T16:40:40.887+00:00"},"s":"W",  "c":"CONTROL",  "id":22140,   "ctx":"initandlisten","msg":"This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip <address> to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning","tags":["startupWarnings"]}
{"t":{"$date":"2020-09-15T16:40:40.887+00:00"},"s":"W",  "c":"CONTROL",  "id":22184,   "ctx":"initandlisten","msg":"Soft rlimits too low","attr":{"currentValue":1024,"recommendedMinimum":64000},"tags":["startupWarnings"]}
{"t":{"$date":"2020-09-15T16:40:40.910+00:00"},"s":"I",  "c":"STORAGE",  "id":20536,   "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}
{"t":{"$date":"2020-09-15T16:40:40.923+00:00"},"s":"I",  "c":"FTDC",     "id":20625,   "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}
{"t":{"$date":"2020-09-15T16:40:40.925+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
{"t":{"$date":"2020-09-15T16:40:40.925+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"127.0.0.1"}}
{"t":{"$date":"2020-09-15T16:40:40.925+00:00"},"s":"I",  "c":"NETWORK",  "id":23016,   "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
{"t":{"$date":"2020-09-15T16:40:41.028+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37876","sessionId":1,"connectionCount":1}}
{"t":{"$date":"2020-09-15T16:40:41.037+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn1","msg":"client metadata","attr":{"remote":"127.0.0.1:37876","client":"conn1","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:41.051+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37878","sessionId":2,"connectionCount":2}}
{"t":{"$date":"2020-09-15T16:40:41.052+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn2","msg":"client metadata","attr":{"remote":"127.0.0.1:37878","client":"conn2","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:41.070+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn1","msg":"connection ended","attr":{"remote":"127.0.0.1:37876","connectionCount":1}}
{"t":{"$date":"2020-09-15T16:40:41.072+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn2","msg":"connection ended","attr":{"remote":"127.0.0.1:37878","connectionCount":0}}
{"t":{"$date":"2020-09-15T16:40:49.924+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37914","sessionId":3,"connectionCount":1}}
{"t":{"$date":"2020-09-15T16:40:49.925+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn3","msg":"client metadata","attr":{"remote":"127.0.0.1:37914","client":"conn3","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:49.932+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37916","sessionId":4,"connectionCount":2}}
{"t":{"$date":"2020-09-15T16:40:49.933+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn4","msg":"client metadata","attr":{"remote":"127.0.0.1:37916","client":"conn4","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:49.941+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37918","sessionId":5,"connectionCount":3}}
{"t":{"$date":"2020-09-15T16:40:49.949+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn5","msg":"client metadata","attr":{"remote":"127.0.0.1:37918","client":"conn5","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:49.997+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn3","msg":"connection ended","attr":{"remote":"127.0.0.1:37914","connectionCount":2}}
{"t":{"$date":"2020-09-15T16:40:49.998+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn5","msg":"connection ended","attr":{"remote":"127.0.0.1:37918","connectionCount":1}}
{"t":{"$date":"2020-09-15T16:40:49.998+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn4","msg":"connection ended","attr":{"remote":"127.0.0.1:37916","connectionCount":0}}
{"t":{"$date":"2020-09-15T16:40:50.103+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37922","sessionId":6,"connectionCount":1}}
{"t":{"$date":"2020-09-15T16:40:50.104+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn6","msg":"client metadata","attr":{"remote":"127.0.0.1:37922","client":"conn6","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:50.107+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37924","sessionId":7,"connectionCount":2}}
{"t":{"$date":"2020-09-15T16:40:50.108+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn7","msg":"client metadata","attr":{"remote":"127.0.0.1:37924","client":"conn7","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:40:50.124+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37926","sessionId":8,"connectionCount":3}}
{"t":{"$date":"2020-09-15T16:40:50.129+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn6","msg":"connection ended","attr":{"remote":"127.0.0.1:37922","connectionCount":2}}
{"t":{"$date":"2020-09-15T16:40:50.130+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn8","msg":"connection ended","attr":{"remote":"127.0.0.1:37926","connectionCount":1}}
{"t":{"$date":"2020-09-15T16:40:50.131+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn7","msg":"connection ended","attr":{"remote":"127.0.0.1:37924","connectionCount":0}}
{"t":{"$date":"2020-09-15T16:41:05.393+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37930","sessionId":9,"connectionCount":1}}
{"t":{"$date":"2020-09-15T16:41:05.394+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn9","msg":"client metadata","attr":{"remote":"127.0.0.1:37930","client":"conn9","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:41:05.396+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:37932","sessionId":10,"connectionCount":2}}
{"t":{"$date":"2020-09-15T16:41:05.397+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn10","msg":"client metadata","attr":{"remote":"127.0.0.1:37932","client":"conn10","doc":{"driver":{"name":"nodejs","version":"3.5.9"},"os":{"type":"Linux","name":"linux","architecture":"x64","version":"5.3.0-19-generic"},"platform":"'Node.js v10.15.2, LE (unified)"}}}
{"t":{"$date":"2020-09-15T16:41:05.423+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn9","msg":"connection ended","attr":{"remote":"127.0.0.1:37930","connectionCount":1}}
{"t":{"$date":"2020-09-15T16:41:05.424+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn10","msg":"connection ended","attr":{"remote":"127.0.0.1:37932","connectionCount":0}}
^C{"t":{"$date":"2020-09-15T16:42:19.568+00:00"},"s":"I",  "c":"CONTROL",  "id":23377,   "ctx":"SignalHandler","msg":"Received signal","attr":{"signal":2,"error":"Interrupt"}}
{"t":{"$date":"2020-09-15T16:42:19.568+00:00"},"s":"I",  "c":"CONTROL",  "id":23380,   "ctx":"SignalHandler","msg":"Signal was sent by the kernel"}
{"t":{"$date":"2020-09-15T16:42:19.568+00:00"},"s":"I",  "c":"CONTROL",  "id":23381,   "ctx":"SignalHandler","msg":"will terminate after current cmd ends"}
{"t":{"$date":"2020-09-15T16:42:19.571+00:00"},"s":"I",  "c":"NETWORK",  "id":20562,   "ctx":"SignalHandler","msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2020-09-15T16:42:19.578+00:00"},"s":"I",  "c":"NETWORK",  "id":23017,   "ctx":"listener","msg":"removing socket file","attr":{"path":"/tmp/mongodb-27017.sock"}}
{"t":{"$date":"2020-09-15T16:42:19.579+00:00"},"s":"I",  "c":"-",        "id":20520,   "ctx":"SignalHandler","msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2020-09-15T16:42:19.579+00:00"},"s":"I",  "c":"-",        "id":4695300, "ctx":"SignalHandler","msg":"Interrupted all currently running operations","attr":{"opsKilled":3}}
{"t":{"$date":"2020-09-15T16:42:19.579+00:00"},"s":"I",  "c":"CONTROL",  "id":20609,   "ctx":"SignalHandler","msg":"Shutting down free monitoring"}
{"t":{"$date":"2020-09-15T16:42:19.579+00:00"},"s":"I",  "c":"FTDC",     "id":20626,   "ctx":"SignalHandler","msg":"Shutting down full-time diagnostic data capture"}
{"t":{"$date":"2020-09-15T16:42:19.582+00:00"},"s":"I",  "c":"STORAGE",  "id":20282,   "ctx":"SignalHandler","msg":"Deregistering all the collections"}
{"t":{"$date":"2020-09-15T16:42:19.582+00:00"},"s":"I",  "c":"STORAGE",  "id":22261,   "ctx":"SignalHandler","msg":"Timestamp monitor shutting down"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22317,   "ctx":"SignalHandler","msg":"WiredTigerKVEngine shutting down"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22318,   "ctx":"SignalHandler","msg":"Shutting down session sweeper thread"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22319,   "ctx":"SignalHandler","msg":"Finished shutting down session sweeper thread"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22320,   "ctx":"SignalHandler","msg":"Shutting down journal flusher thread"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22321,   "ctx":"SignalHandler","msg":"Finished shutting down journal flusher thread"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22322,   "ctx":"SignalHandler","msg":"Shutting down checkpoint thread"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22323,   "ctx":"SignalHandler","msg":"Finished shutting down checkpoint thread"}
{"t":{"$date":"2020-09-15T16:42:19.583+00:00"},"s":"I",  "c":"STORAGE",  "id":22324,   "ctx":"SignalHandler","msg":"Closing WiredTiger in preparation for reconfiguring","attr":{"closeConfig":"leak_memory=true,"}}
{"t":{"$date":"2020-09-15T16:42:19.597+00:00"},"s":"I",  "c":"STORAGE",  "id":4795905, "ctx":"SignalHandler","msg":"WiredTiger closed","attr":{"durationMillis":14}}
{"t":{"$date":"2020-09-15T16:42:19.611+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"SignalHandler","msg":"WiredTiger message","attr":{"message":"[1600188139:611666][1133:0x7f7b85ccc700], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 21 through 22"}}
{"t":{"$date":"2020-09-15T16:42:19.666+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"SignalHandler","msg":"WiredTiger message","attr":{"message":"[1600188139:666906][1133:0x7f7b85ccc700], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 22 through 22"}}
{"t":{"$date":"2020-09-15T16:42:19.762+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"SignalHandler","msg":"WiredTiger message","attr":{"message":"[1600188139:762598][1133:0x7f7b85ccc700], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Main recovery loop: starting at 21/5760 to 22/256"}}
{"t":{"$date":"2020-09-15T16:42:19.866+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"SignalHandler","msg":"WiredTiger message","attr":{"message":"[1600188139:866564][1133:0x7f7b85ccc700], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 21 through 22"}}
{"t":{"$date":"2020-09-15T16:42:19.928+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"SignalHandler","msg":"WiredTiger message","attr":{"message":"[1600188139:928597][1133:0x7f7b85ccc700], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 22 through 22"}}
{"t":{"$date":"2020-09-15T16:42:19.980+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"SignalHandler","msg":"WiredTiger message","attr":{"message":"[1600188139:980661][1133:0x7f7b85ccc700], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global recovery timestamp: (0, 0)"}}
{"t":{"$date":"2020-09-15T16:42:19.986+00:00"},"s":"I",  "c":"STORAGE",  "id":4795904, "ctx":"SignalHandler","msg":"WiredTiger re-opened","attr":{"durationMillis":389}}
{"t":{"$date":"2020-09-15T16:42:19.986+00:00"},"s":"I",  "c":"STORAGE",  "id":22325,   "ctx":"SignalHandler","msg":"Reconfiguring","attr":{"newConfig":"compatibility=(release=3.3)"}}
{"t":{"$date":"2020-09-15T16:42:20.006+00:00"},"s":"I",  "c":"STORAGE",  "id":4795903, "ctx":"SignalHandler","msg":"Reconfigure complete","attr":{"durationMillis":20}}
{"t":{"$date":"2020-09-15T16:42:20.006+00:00"},"s":"I",  "c":"STORAGE",  "id":4795902, "ctx":"SignalHandler","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,"}}
{"t":{"$date":"2020-09-15T16:42:20.011+00:00"},"s":"I",  "c":"STORAGE",  "id":4795901, "ctx":"SignalHandler","msg":"WiredTiger closed","attr":{"durationMillis":5}}
{"t":{"$date":"2020-09-15T16:42:20.011+00:00"},"s":"I",  "c":"STORAGE",  "id":22279,   "ctx":"SignalHandler","msg":"shutdown: removing fs lock..."}
{"t":{"$date":"2020-09-15T16:42:20.011+00:00"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"SignalHandler","msg":"Now exiting"}
{"t":{"$date":"2020-09-15T16:42:20.011+00:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"SignalHandler","msg":"Shutting down","attr":{"exitCode":0}}

I could easily realise since I use the following command to run mongodb:
mongod --fork --logpath /var/log/mongodb/mongod.log --dbpath /var/www/covid19livespread.com/data/db/ --config /etc/mongod.conf

I got the following error:
forked process: 1375

ERROR: child process failed, exited with 14

To see additional information in this output, start without the "--fork" option.

I couldn’t find any information online so I had to use my backup data and re-build all of my collections.

Is there a way to prevent such data corruption? How do I make sure mongodb doesn’t cause memory leaks and prevent data corruption?