[Genhis] [2.0.43] OSX only hang in mapgen code

This subforum contains all the issues which we already resolved.
cliff_build
Inserter
Inserter
Posts: 24
Joined: Thu Dec 03, 2020 4:52 pm
Contact:

[Genhis] [2.0.43] OSX only hang in mapgen code

Post by cliff_build »

What did you do?
I played a multiplayer game with the Warp-Drive-Machine mod with some windows PCs and an OSX (M1/arm64) laptop.
What happened?
The OSX factorio instance hangs soon after landing on a new planet. The windows instances work just fine.
What did you expect to happen instead? It might be obvious to you, but do it anyway!
I expected all clients to behave the same way (and ideally not hang).
Does it happen always, once, or sometimes?
I have a save that reproduces this problem (attached).

I did some amount of debugging attempts. When factorio is hung in this state, it is using 1 CPU worth of resources, and running commands like

Code: Select all

sudo sample 3236 10 -file /tmp/factorio_sample2.txt
gives output that includes the following (which implies to me that the game is busy doing some sort of map generation code). I don't know a lot about Warp Drive Machine, but this is just after the ship landed on a new alien-biomes planet. Notice that the sampled stacks do not have any lua code running that I can see.

I have not tried loading the save on linux, so I don't know whether it works there or not.

I am willing to do work to try and help debug, including changing the mod code. I'd love to at least have some understanding of what I should even be looking for though. I don't really understand what would cause infinite-map-generation.

Note that in the attached save, the game actually hangs a tiny bit after loading (maybe 30 ticks or something).

Code: Select all

    8360 Thread_37889358: MapGenerationHelper
      8360 thread_start  (in libsystem_pthread.dylib) + 8  [0x185cef0fc]
        8360 _pthread_start  (in libsystem_pthread.dylib) + 136  [0x185cf42e4]
          8360 std::__thread_proxy[abi:v160006]<std::tuple<std::unique_ptr<std::__thread_struct>, void (MapGenerationHelper::*)(), MapGenerationHelper*>>(void*)  (in factorio) + 72  [0x106c689f>
            8360 MapGenerationHelper::consumeTasks()  (in factorio) + 484  [0x106001f80]  MapGenerationHelper.cpp:153
              8360 EntityMapGenerationTask::compute()  (in factorio) + 52  [0x105fdfba4]  EntityMapGenerationTask.cpp:111
                8360 EntityMapGenerationTask::computeInternal()  (in factorio) + 104  [0x105fdfc70]  EntityMapGenerationTask.cpp:134
                  8357 Noise::multioctaveNoise(float, float, unsigned int, unsigned int, float, float, float, float, float, NoiseScratch&, float*) const  (in factorio) + 332  [0x1060f5e84]  Noi>
                  ! 3516 Noise::noise(float, float, unsigned int, unsigned int, float, float, float, NoiseScratch&, float*) const  (in factorio) + 900,904,...  [0x1060f57bc,0x1060f57c0,...]  No>
                  ! 2044 Noise::noise(float, float, unsigned int, unsigned int, float, float, float, NoiseScratch&, float*) const  (in factorio) + 864,836,...  [0x1060f5798,0x1060f577c,...]  No>
                  ! 969 Noise::noise(float, float, unsigned int, unsigned int, float, float, float, NoiseScratch&, float*) const  (in factorio) + 888,884,...  [0x1060f57b0,0x1060f57ac,...]  Noi>
Attachments
factorio-current.log
(10.76 KiB) Downloaded 17 times
factorio_sample2.txt
stack traces from hang
(211.63 KiB) Downloaded 14 times
hanging-save-on-osx.zip
(12.08 MiB) Downloaded 18 times
StrangePan
Factorio Staff
Factorio Staff
Posts: 228
Joined: Fri Dec 07, 2018 3:41 pm
Contact:

Re: [Strangepan] [2.0.43] OSX only hang in mapgen code

Post by StrangePan »

Hi, is this the correct save? It doesn't seem to have any of the mods that are listed in your log file.
cliff_build
Inserter
Inserter
Posts: 24
Joined: Thu Dec 03, 2020 4:52 pm
Contact:

Re: [Strangepan] [2.0.43] OSX only hang in mapgen code

Post by cliff_build »

I'm so sorry, it was not the correct save. This is the correct one.
Attachments
BobTHEBUILDER WARP-broken.zip
(1.6 MiB) Downloaded 30 times
StrangePan
Factorio Staff
Factorio Staff
Posts: 228
Joined: Fri Dec 07, 2018 3:41 pm
Contact:

Re: [Genhis] [2.0.43] OSX only hang in mapgen code

Post by StrangePan »

No problem! We were able to reproduce the issue with the new save you sent us.
Genhis
Factorio Staff
Factorio Staff
Posts: 823
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [2.0.43] OSX only hang in mapgen code

Post by Genhis »

Thanks, the save file helped! The problem in map generation was caused by undefined behavior when casting infinity (float) to unsigned integer. For 2.0.49, I added more checks around this place and it will throw an exception if `MultioctaveNoise::octaves` is negative or infinite. Old saves will get a migration, but the mod author will have to fix map generation on their end. Most likely it's a division by zero somewhere in noise expressions which causes the octaves value to be infinite.
cliff_build
Inserter
Inserter
Posts: 24
Joined: Thu Dec 03, 2020 4:52 pm
Contact:

Re: [Genhis] [2.0.43] OSX only hang in mapgen code

Post by cliff_build »

Thank you!
User avatar
FerrariMAF
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Fri May 26, 2017 11:39 am
Contact:

Re: [Genhis] [2.0.43] OSX only hang in mapgen code

Post by FerrariMAF »

Hi there @Genhis. The the new version is now raising the error, but I'm debugging and not finding the cause of the issue... its a map_gen_setting..
I have no idea what MultioctaveNoise::octaves are... =(

In my tests, the issue is on the map_gen_setting used to create a new surface... I made a console command with the mapgen used, and the error show up on the console...(file attached) Can you help me to find out what is wrong with this mapgen? it uses space age and alien biomes mod...
multioctaveerror.lua
(49.52 KiB) Downloaded 18 times
Post Reply

Return to “Resolved Problems and Bugs”