Page 1 of 1

[32bit only] Bad allocation error crashes

Posted: Sun Nov 15, 2015 17:20
by Fixer
I'm using latest Krock's build of minetest-0.4.13-4434498 (13 Nov 2015) 32bit + today's minetest_game on Windows 7 64bit, if I walk around long enough, usually 30-60 min, game memory usage will grow up to 1.6 GB and crash after that giving me those errors. I have 8 GB of RAM and view range is 180-240 nodes and scenery is very very rich with lots of different forests and mountains. In less crowded areas I have steady 800-1000mb memory usage and no crash.

If it is "low memory" crash... then why MT is not unloading blocks away to be within 32bit limits?
BTW, you can avoid this problem in a different ways:
1) use 64bit OS and 64bit build of minetest (default download anyway) -- best option
2) lower client_mapblock_limit in minetest.conf;

Example #1

Code: Select all

2015-11-15 18:32:16: ERROR[Emerge-0]: An unhandled exception occurred: bad allocation
2015-11-15 18:32:16: ERROR[Emerge-0]: In thread b7c:
2015-11-15 18:32:16: ERROR[Emerge-0]: ..\..\minetest\src\emerge.cpp:2c1: EmergeThread::run: A fatal error occured: bad allocation
2015-11-15 18:32:16: ERROR[Emerge-0]: Debug stacks:
2015-11-15 18:32:16: ERROR[Emerge-0]: DEBUG STACK FOR THREAD 604: 
2015-11-15 18:32:16: ERROR[Emerge-0]: #0  UpdateThread::run
2015-11-15 18:32:16: ERROR[Emerge-0]: DEBUG STACK FOR THREAD b7c: 
2015-11-15 18:32:16: ERROR[Emerge-0]: #0  EmergeThread::run
2015-11-15 18:32:16: ERROR[Emerge-0]: DEBUG STACK FOR THREAD 1344: 
2015-11-15 18:32:16: ERROR[Emerge-0]: #0  UpdateThread::run
2015-11-15 18:32:16: ERROR[Emerge-0]: DEBUG STACK FOR THREAD 15a8: 
2015-11-15 18:32:16: ERROR[Emerge-0]: #0  main
2015-11-15 18:32:16: ERROR[Emerge-0]: #1  ClientMap::renderMap
2015-11-15 18:32:16: ERROR[Emerge-0]: DEBUG STACK FOR THREAD 15cc: 
2015-11-15 18:32:16: ERROR[Emerge-0]: #0  ServerThread::run
2015-11-15 18:32:16: ERROR[Emerge-0]: #1  Server::Receive
Example #2:

Code: Select all

2015-11-15 19:11:54: ERROR[MeshUpdate]: An unhandled exception occurred: bad allocation
2015-11-15 19:11:54: ERROR[MeshUpdate]: In thread 1688:
2015-11-15 19:11:54: ERROR[MeshUpdate]: e:\programme\mt_compiler\minetest\src\util/thread.h:e2: UpdateThread::run: A fatal error occured: bad allocation
2015-11-15 19:11:54: ERROR[MeshUpdate]: Debug stacks:
2015-11-15 19:11:54: ERROR[MeshUpdate]: DEBUG STACK FOR THREAD 53c: 
2015-11-15 19:11:54: ERROR[MeshUpdate]: #0  main
2015-11-15 19:11:54: ERROR[MeshUpdate]: #1  ClientMap::renderMap
2015-11-15 19:11:54: ERROR[MeshUpdate]: DEBUG STACK FOR THREAD 122c: 
2015-11-15 19:11:54: ERROR[MeshUpdate]: #0  EmergeThread::run
2015-11-15 19:11:54: ERROR[MeshUpdate]: DEBUG STACK FOR THREAD 139c: 
2015-11-15 19:11:54: ERROR[MeshUpdate]: #0  ServerThread::run
2015-11-15 19:11:54: ERROR[MeshUpdate]: #1  Server::Receive
2015-11-15 19:11:54: ERROR[MeshUpdate]: DEBUG STACK FOR THREAD 161c: 
2015-11-15 19:11:54: ERROR[MeshUpdate]: #0  UpdateThread::run
2015-11-15 19:11:54: ERROR[MeshUpdate]: DEBUG STACK FOR THREAD 1688: 
2015-11-15 19:11:54: ERROR[MeshUpdate]: #0  UpdateThread::run
On a side note, I test it on a very nice seed, with lots of forests and stuff, screenshot of the place:
Image

Re: [0.4.13-dev] Bad allocation error crashes

Posted: Thu Nov 19, 2015 21:54
by Sokomine
I sometimes get crashes with my villages mod. In that regard, I do have the choice between shadow bugs (especially in the shell of mapchunks) and occasional crashes at mapgen time.

Re: [32bit only] Bad allocation error crashes

Posted: Thu Feb 18, 2016 15:25
by Fixer

Re: [32bit only] Bad allocation error crashes

Posted: Fri Feb 03, 2017 17:02
by Robsoie
Still noticing this when i explore a lot on my 32bits OS (and then version of Minetest, using latest Krock build for it, 170128 at that time ).

For testing purpose i generated a world with mgv7 , only minetest_game, no additional mods and in the minetest.conf :

map_generation_limit = 320
(default is 31000)
So it's still plenty big enough for exploring, but not big enough to be too big to see the end of it
And added
mg_biome_np_heat = 50, 50, (200, 200, 200), 5349, 3, 0.5, 2.0
mg_biome_np_humidity = 50, 50, (200, 200, 200), 842, 3, 0.5, 2.0
So biomes weren't big enough to fill the world with only a couple of them, making then exploration visually more varied and so less boring.

After a while of flying around that world

Code: Select all

ACTION[Server]: singleplayer leaves game. List of players: 
ERROR[Main]: Some exception: "bad allocation"
[Main]:  >> === FATAL ERROR ===
[Main]:  >> Access violation (Exception 0xC0000005) at 0x00AA34C9
oddly it meantions that singleplayer leaves game, despite i was flying over the terrain when suddenly the game freeze and crash.

So for more testing purpose, i then added in my minetest.conf
client_mapblock_limit = 100
(default is 5000)
Launched the game, re-explored that world and saw no visual difference (i was expecting to see less block, but it was exactly the same, certainly more than 100 in my screen) and after a long while of exploration : same freeze->crash and error in the log.

I am wondering if client_mapblock_limit actually does something ? Because i noticed visually absolutely no difference, after a very long exploration a minute before the crash i could press R to see max view distance and saw all the chunks of the world i had already explored, meaning there was surely (a whole lot) more than 100 blocks in my view (and so in memory).

Re: [32bit only] Bad allocation error crashes

Posted: Mon Feb 20, 2017 21:12
by DI3HARD139
Oh good. I thought I was the only one getting the random bad_alloc error. I run an x64 build from the main repo though.

Re: [32bit only] Bad allocation error crashes

Posted: Mon Feb 27, 2017 22:29
by Robsoie
It seems regardless of me setting a specific client_mapblock_limit in my minestest.conf it never made any visual difference, and so after long exploration the crash always happens.
And even if i set it to super low like client_mapblock_limit=100 , there was still no visual difference ingame i always could see much more than 100 blocks with my default view range (and way too much to count if i use the max view)

I noticed a possible reason, as everytime when exiting the game if i look into my minetest..conf file, the setting is automatically reset to client_mapblock_limit=5000 , regardless of the setting i set it up for it previously.

So i am starting to wonder is that 5000 value actually a hardcoded set with no way to change it in the minestest.conf with the game simply ignoring whatever value i set and always use 5000 ?