Page 1 of 1

[1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 5:03 pm
by TwoAbove
Hello!

To reproduce, just load the game and try running any surface trim tool (both SE's one or to Delete Chunk mod). Both will successfully delete the chunks, but after the game will just freeze and will only be killable (sigterm does not work, only sigkill).

A single surface.delete_chunk command also causes this.

Save file: https://drive.google.com/drive/u/1/fold ... shsslYpVMl

No error logs are saved, unfortunately.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 7:23 pm
by Rseding91
Thanks for the report. I looked into it and the issue is: when you trim the surface it deletes a crazy amount of entities (of which almost all are registered in the entity-destroyed event logic).

The end result is: there are 485642 entities deleted (when I trim nauvis) and all of them get put into the to-event list for the on_entity_destroyed event. The game then goes to send those events and the listening mods are doing some super slow operation such that each entity takes 0.2 seconds to process in the mods event handlers.

I estimate if you let it run on my laptop it would be done in 27 hours. Alternatively you can try contacting the mod authors and see which one of them has some poor-performance code making the events take so long.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 8:33 pm
by TwoAbove
Wow, that's crazy!

Are there any traces available or something, so I can better pin-point which mod is causing this?

Also, how did you calculate the time it takes to go the event processing? That would have helped debug this issue from my end.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 9:12 pm
by Stringweasel
Does't deleting chunks just take long in general though? I don't have much experience in trimming surfaces in SE, but when I reduce save files for the Hall of Fame I sometimes need to let it run through the night. And there was no mod handlers running, only tons and tons of entities.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 9:22 pm
by TwoAbove
Good to know.

I just started the trimming process. I wonder how long it will take

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 9:51 pm
by jan1i3
We have done some profiling as a group effort in the discord and have noticed that by far the slowest mod in this case is fCPU.
You can see the report for details.

As for what you can do... well
Removing the mod, trimming and then adding the mod again isn't really an option.
So, unless i'm terribly wrong, i don't think there is anything you can do in the meantime except wait for the bug to be fixed. Or wait 27 hours, possibly longer if your pc is slower.

There is still the chance there is another mod causing issues (we're still waiting on more data for that), but as i said fCPU is by far the biggest one.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sat Aug 21, 2021 11:52 pm
by TwoAbove
Disabling Treees seems to have made it faster, when checking by deleting 1 chunk. I don't think I have many fCPUs in the world.

Turns out the mod adds all trees to a list, and deleting many trees from a chunk deletes them from this enormous list.

I'd say this thread might be more suited for a not-a-bug status.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sun Aug 22, 2021 1:19 am
by Rseding91
Stringweasel wrote:
Sat Aug 21, 2021 9:12 pm
Does't deleting chunks just take long in general though?
No, deleting chunks is near instant on the C++ side of things. Most if not all slowdown that might occur is from the mod(s) implementing a "scan the chunk to see what's on it before deleting it" and or reacting to it being deleted.

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sun Aug 22, 2021 4:35 pm
by TwoAbove
You were right, fCPU was the culprit — by removing it the whole thing finished in 10s

Re: [1.1.38] [MOD] Space Exploration - surface.delete_chunk causes permanent freeze

Posted: Sun Nov 05, 2023 2:08 am
by extermeon
The issue in fCPU was fixed recently