Construction Approvals

by azaghal

Ghosts require player's approval before construction bots are dispatched. This gives the player improved control over what parts of the factory get built, and when.

Utilities
5 months ago
1.1 - 2.0
3.70K
Logistic network Blueprints

b [CONFIRMED] Crash when force-pasting blueprint on existing structure while auto-approve disabled

5 months ago

Force-pasting a blueprint on an existing structure (a load balancer blueprint onto an existing 4 belt main bus line), while auto-approve is disabled, crashes the game.

The crash does not occur when auto-approve is enabled. Also it doesn't occur when the mod is disabled. The original "Construction Planner" mod has the same issue - I actually switched to this one in hopes of fixing it ^^

Factorio crashed. Generating symbolized stacktrace, please wait ...
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Entity\BuildCheckResult.cpp(144): BuildCheckResult::abortIfNotBuildable
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Entity\TransportBeltConnectable.cpp(446): TransportBeltConnectable::checkConsistency
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Entity\EntityGhost.cpp(629): EntityGhost::checkConsistency
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Map\ConsistencyScraper.cpp(41): ConsistencyScraper::step
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Game.cpp(175): Game::update
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Scenario\Scenario.cpp(1130): Scenario::updateStep
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\MainLoop.cpp(1417): MainLoop::gameUpdateStep
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\MainLoop.cpp(1212): MainLoop::gameUpdateLoop
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\functional(823): std::_Func_impl_no_alloc<`MainLoop::mainLoopStep'::`2'::<lambda_1>,void>::_Do_call
C:\Users\build\AppData\Local\Temp\factorio-build-zTo8Fr\src\Util\WorkerThread.cpp(71): WorkerThread::loop
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\thread(56): std::thread::_Invoke<std::tuple<void (__cdecl QueuedSoundInstanceSDL::QueuedSoundData::*)(void),QueuedSoundInstanceSDL::QueuedSoundData *>,0,1>
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp(97): thread_start<unsigned int (__cdecl*)(void *),1>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE34FD259D)
00007FFE34FD259D (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE35A4AF38)
00007FFE35A4AF38 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
  31.108 Error BuildCheckResult.cpp:148: Build check failed: 3, cant-build-reason.entity-in-the-way(entity-name.fast-transport-belt), entity[[name=fast-splitter, type=splitter(Splitter), position={31.000, -6.500}, direction=North, force=player.unapproved_ghosts, surface=nauvis, setup=false, owned-by-ghost=true, to-be-deconstructed=false, to-be-upgraded=false, simulation=true]], collider[[name=fast-transport-belt, type=transport-belt(TransportBelt), position={30.500, -6.500}, direction=North, force=player, surface=nauvis, setup=true, owned-by-ghost=false, to-be-deconstructed=true, to-be-upgraded=false, simulation=false]].
  31.108 Error CrashHandler.cpp:643: Received 22
Logger::writeStacktrace skipped.
  31.108 Info ConsistencyScraper.cpp:83: queued check: entity [name=entity-ghost, type=entity-ghost(EntityGhost), position={31.000, -6.500}, direction=North, force=player.unapproved_ghosts, surface=nauvis, setup=true, owned-by-ghost=false, to-be-deconstructed=false, to-be-upgraded=false, simulation=false]
  31.108 Error CrashHandler.cpp:190: Map tick at moment of crash: 26230470
  31.142 Info CrashHandler.cpp:318: Executable CRC: 483359364
  31.142 Error Util.cpp:95: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.

I can provide a savegame if necessary πŸ™‚

5 months ago

Hello RainShell,

Was this the whole game going down? Was there no Lua backtrace shown in a window? Because if so... There's high chances this particular crash might actually be on the game engine side - although if I can fix it up somehow mod-side, I might give it a go. Also not guaranteeing it that the mod is not doing something unsavory. :)

Are you able to provide me with some kind of minimal reproduction steps - perhaps a blueprint or two and instructions on how to overlap them to trigger the crash? And do you happen to have some more info for me - like game version, mod version, whether you can reproduce it with only Construction Approvals installed etc? Otherwise - if savegame is the only thing you can reproduce it with, that'd work as well, so long you provide me with info on what to force-build on top of what.

Best regards,
Branko

5 months ago

Ok, I may have been able to reproduce it just now - had to try force-placing on top of built entities. The extra info would still be useful, just in case. :)

Best regards,
Branko

5 months ago

Hi azaghal, sorry for the late response! I finally did some testing and now know the following:

  • Yes, the whole game crashes with just a dialog box (text snippe below, I guess you probably know that error dialog?)
    <details>
    <summary>Error</summary>
    Unexpected error occured. If you're running the latest version [blablabla]. Would you like to open the folder containing the log file?
    </details>
  • The crash occurs even with only Construction Approvals enabled (besides the Base Mod)
  • (The crash does not occur with Construction Approvals disabled)
  • The crash can be triggered by simply placing a single yellow belt and then force-pasting the ghost of a single yellow belt (that points in a different direction) on the existing belt. (Don't forget to disable auto-approval - I forgot that pre-condition when testing today and was confused why the bug seemed to be gone πŸ€“)
  • Factorio 2.0.43
  • Construction Approvals 5.1.1

Hope that helps!

4 months ago

Hey, no worries, and thanks for all the extra info. That is basically the same test I ended up with as well in the end :D I just assumed it was going to be something a bit more complicated based on some previous kinda related bug I worked on fixing.

So... I am almost 100% sure this is a bug in Factorio game engine itself, and I think it relates to me changing the force of the placed ghost entity (still have to try with a minimal control script to make sure it is the case). Unfortunately... This is kinda fundamental to mod's functioning, so won't be looking into workarounds for it at the moment. But - I will try to reproduce it with something more minimal and report the bug to Wube. I'll throw in a link to the forum post in here then for tracking purposes at least. :)

I did do some testing with different versions of Factorio, and it seems the bug got introduced in-between versions 2.0.28 (worked fine without crash) and 2.0.42 (crashed every single time).

Best regards,
Branko

4 months ago

Ok, thank you πŸ™‚

I don’t crash the game often anymore in that way, I kinda learned when not to force-paste without auto-approval enabled. So I can still use the mod in its current state. Thanks for your responsiveness!

4 months ago

Well, someone had apparently already snitched on me reported the bug on the forums about this, so I have posted some extras under that one (although devs seem kinda aware of the problem, but the sample code/reproduction steps might be helpful for simplicity sake).

I would probably need to understand a bit better on why this type of force change could lead to a desync (as mentioned in that thread), and wait a little bit to see if they would look into fixing the actual crash before I try to figure out that part.

I wonder if the result of this would lead to Wube adding an "ignore" flag for bots or to me giving up on this particular mod. :)

Best regards,
Branko

New response