Page 1 of 1

[boskid][0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sat Mar 21, 2020 1:59 pm
by Mat46
Hello

Il have a intermittent problem in the game on manual save or autosave.

In the log, i see 2 errors :
- the first with visual studio 2017
- the second with RailSignalBase

Is this a problem with a mod or something else ?

Thank you for your answer.
Mat

Factorio Log :
factorio-current.log
(75.79 KiB) Downloaded 137 times
Mod List :
mod-list.json
(1.75 KiB) Downloaded 139 times
My save :
Solo.zip
(5.91 MiB) Downloaded 138 times

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sat Mar 21, 2020 3:10 pm
by Loewchen
If you have repeated unrelated crashes you can not reliably reproduce then the issue is your hardware/OS/driver and not the game.

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sat Mar 21, 2020 3:17 pm
by Mat46
Ok, i check this.

Thank you
Mat

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sat Mar 21, 2020 3:23 pm
by Loewchen
I'd start with: https://www.memtest.org/ let it run for several complete loops or until an error.

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sun Mar 22, 2020 9:47 am
by Mat46
Hello

I run Memtest 3 times in the row (for the moment 0 errors). I will continue the test in the next week.

For info, my pc have 5 month. I changed everything except the graphics card and 2 hard drives. (PC Assembled).

I checked all the update for windows, drivers, .. and all is ok.
I uninstalled all versions of visual basic and installed only visual basic 2019 -> Same Problem.
I uninstalled factorio and reinstalled -> Same Problem.

I didn't have the problem in previous versions.

I noticed that I make a manual backup right after loading my save, I don't have the problem.
If I start playing for 5 minutes and save, I have the bug.

I'm going to do other tests by deactivating mods

Thank You
Mat

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sun Mar 22, 2020 10:21 am
by Mat46
Hello

I think i found the problem.

The problem comes from the "Train Construction Site" mod. If I put a rail signal next to the block (see the photo attached), I have the problem.
I will contact the modder to tell him the problem.

Thank you
Mat
Factorio.png
Factorio.png (3.02 MiB) Viewed 5537 times

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Sun Mar 22, 2020 2:04 pm
by Loewchen
Mods generally should not be able to cause crashes so this should still be fixed game side. Is the save you provided the save you can reproduce this with?

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Mon Mar 23, 2020 7:03 am
by Mat46
Hello

Yes, this is the save with which we can reproduce the problem.
I tested it several times with an automatic and manual backup.

Thank You
Mat

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Wed Apr 22, 2020 3:07 am
by dpacbach
"incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed


note to devs... const_cast is a code smell!

Re: [0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed

Posted: Wed Apr 22, 2020 5:09 am
by Rseding91
dpacbach wrote:
Wed Apr 22, 2020 3:07 am
"incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" failed


note to devs... const_cast is a code smell!
And yet, it doesn't matter.

Re: [boskid][0.18.15] Crash on save: "incomingBlock->getOutboundSignals().count(const_cast<RailSignalBase*>(this))" fail

Posted: Mon Oct 19, 2020 2:15 pm
by boskid
Ok, after wasting too much time trying to find a nice solution i went berserk and fixed it the hard way:
- as stated in 86385, every rail signals will have to have collision masks that collide with each other to prevent multiple rail signals from being placed on the same tile.
- when trying to build a rail signal not on a tile center, the rail signal build position will be changed to be on a tile center (aka floor(x)+0.5)
- flag "placeable-off-grid" on any rail signal will be ignored.
- rail signal collision box is hardcoded to {{-0.2, -0.2}, {0.2, 0.2}} to prevent defining collision box that would not contain a {0,0} point inside preventing multiple signals at the same position from colliding with each other. This is also to make sure signal will be properly found when looking for a too-close signal on adjacent tile.
- if by any chance (or using editor's clone or scripted clone without snap-to-grid) a rail signal would land not on a tile center, it will not be considered valid so it will not bind to the rails
- all the saves from before 1.1.0 will have rail segments recomputed so if there are any signals not on a tile center, they will detach from rails immediately.

Unfortunately there are some assumptions that are important for rail signals logic to work so i will not remove any of those restrictions.