[2.0.77][mac] Crash (SIGBUS)

We are aware of them, but do not have solutions that don't cause other issues. They go here in order not to take space in the main bug thread list.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 194
Joined: Tue Feb 06, 2024 5:18 am
Contact:

[2.0.77][mac] Crash (SIGBUS)

Post by hgschmie »

(nothing in the factorio-current.log file)

Crash log from the MacOS crash reporter. Also sent it to Apple, so you may receive it from there as well.

basically, there is a mod that has a handler for entity creation. In that handler, it destroys the entity that the handler was called for and creates a new one (with same name, type etc., just different orientation). When adding "raise_built = true" to the 'create_entity' call, the game crashes hard.

I'll try to whip up an actual test case if you need one.
Attachments
factorio-crash.txt
(272.93 KiB) Downloaded 8 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 16818
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.77] crash straight to MacOS

Post by Rseding91 »

When adding "raise_built = true" to the 'create_entity' call, the game crashes hard.
That's infinite recursion. Of course that will crash. You simply can't do that.
If you want to get ahold of me I'm almost always on Discord.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 194
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: [2.0.77][mac] Crash (SIGBUS)

Post by hgschmie »

I would have expected the engine to catch this (and maybe crash the mod) after a certain number of levels (e.g. 100 or so). The "crash straight to MacOS" was surprising.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16818
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.77][mac] Crash (SIGBUS)

Post by Rseding91 »

It's almost never worth trying to detect infinite recursion because it adds a performance cost at all times for the "this should never happen to being with" state. Since the engine has not way to "safely handle" infinite recursion happening the only fix is "don't do that" and it's better performance wise to let it crash and have the mod author fix the code than *try* to detect when it's happening and show an error + then crash. On Windows and linux we have special-case error handling that detects a generic stack-overflow error and shows the standard "Factorio crashed ..." but with a special message saying "stack overflow" and printing the stack at the time of crash. It's special case because it uses platform-specific logic to communicate across threads when a stack-overflow happens.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Stargateur
Filter Inserter
Filter Inserter
Posts: 436
Joined: Sat Oct 05, 2019 6:17 am
Contact:

Re: [2.0.77][mac] Crash (SIGBUS)

Post by Stargateur »

Agreed, as long as there is no security issue, stack overflow is the problem of mod.
Post Reply

Return to “Minor issues”