MongoDB services crashes unexpectedly / WiredTiger error message

Hello! We have a problem with our MongoDB service, that crashes constantly after running a short or very short period. It is running on windows server with 16Gb of Ram (which does not seem to be saturated). The error is the following :

{“t”:{“$date”:“2023-07-20T13:17:49.845-03:00”},“s”:“E”, “c”:“WT”, “id”:22435, “ctx”:“conn20”,“msg”:“WiredTiger error message”,“attr”:{“error”:12,“message”:{“ts_sec”:1689869869,“ts_usec”:845107,“thread”:“128:140718687146976”,“session_dhandle_name”:“file:collection-7–7905082630262738936.wt”,“session_name”:“”,“category”:“WT_VERB_DEFAULT”,“category_id”:9,“verbose_level”:“ERROR”,“verbose_level_id”:-3,“msg”:“int __cdecl __realloc_func(struct __wt_session_impl *,unsigned __int64 *,unsigned __int64,bool,void *):134:memory allocation of 662780 bytes failed”,“error_str”:“Not enough space”,“error_code”:12}}}

We have tried to change the configuration of WireTiger to limit memory, but no success
cacheSizeGB: 2

Anyone having an idea of the source of the problem and how to fix it?

Thanks a lot!

Failed to allocate only 1MB of mem?
what’s your memory usage rate?

Rate is around 70-75% of 16Gb.

Hi @Nico_R1 welcome to the community!

Anecdotally, I’ve seen a similar error message when MongoDB is running inside a Docker environment. There was an issue where older versions of MongoDB would detect the system’s RAM instead of the container’s RAM, and would be stopped from acquiring memory. Since this situation is outside of WiredTiger’s control (requesting memory but refused by the OS), it will raise an exception similar to this one. This was fixed in SERVER-16571.

If you’re not using the latest supported version of MongoDB, could you try again with the latest version and see if this is still happening?

If this still happens, could you post your MongoDB version, your deployment environment, and steps that can reliably produce this error?

Best regards


Hello! If it can help others, here is what we did to avoid this MongoDB service crash. In the advanced system settings, we have allowed the system to create a paging file for the virtual memory when needed. It seems that the crash were happening when no more Virtual Memory was available for the system. In that case, the system was not allowed to swap on the disk, and Mongo DB was stopped when failing to allocate memory. I must say that we are not 100% sure whether it is the true reason why the problem happened, neither if this solution will fix it definately… But, since that change in the settings, it works fine, without any impact on the system performances. No more issue for the last month (when it used to happen several times a day before the fix). Here is a screenshot to explain what has been done :

PS: If our conclusion is right (crash due to lack of virtual memory) this behaviour of MongoDB would be worth being changed in a future release. It would be better to downgrade a bit the performances the time virtual memory is released, rather than crashing the system.