[1.1.57] Crash on overbuild with script

This subforum contains all the issues which we already resolved.
somethingtohide
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Apr 15, 2022 11:56 pm
Contact:

[1.1.57] Crash on overbuild with script

Post by somethingtohide »

I've encountered a reproducible crash using the base game plus my own mod. I actually worked-around this crash which might shed insight into why it happens, and I'll describe that at the end of this post. All bug-introducing and bug-bandaiding logic is present in this script file. This could be my own fault, but I think there's an underlying bug too.

The purpose of that part of the mod is to mimic the EditorController's capabilities while using a GodController, inside of a separate "Sandbox" Surface, as an easily-accessible testing/designing ground. The issue occurs when Reviving Ghosts and handling Upgrades during their on_built_entity or on_marked_for_upgrade Events, specifically for certain interactions with Underground Belts.

Previously I saw this with the Smart-Belts enabled and calling revive in the on_built_entity Event when a Belt is dragged and converted into an Underground Belt. However, this reproducible bug is regardless of that setting, and involves calling create_entity during on_marked_for_upgrade after dragging a Belt over an existing Underground Belt of a different type when the Underground Belt is present in the inventory but the Belt is not. I'm unsure if they're the exact same root cause, or if they need separate fixes, but I could not reproduce the previous issue with this save.

Using the attached save, there are three ways to proceed:

Expected Behavior
  1. There are Yellow Belts and Undergrounds in the Inventory
  2. Using the Yellow Belt, drag a line over the existing Red Undergrounds
  3. All Belts are placed, and the existing Red Undergrounds are Upgraded to Yellow
Bugged Behavior
  1. There are Red Undergrounds in the Inventory, but not Red Belts
  2. Swap to the Red Belts via Hotbar, then drag a line over the existing Blue Undergrounds
  3. All Red Belts are immediately placed as Ghosts, but also immediately created by the God.Revive function
  4. The Red Underground will cause the crash, probably from the God.Upgrade function
Worked-Around Behavior
  1. Open Mod Settings, and increase the "Async-per-tick Upgrades" to anything above 0
  2. There are Red Undergrounds in the Inventory, but not Red Belts
  3. Swap to the Red Belts via Hotbar, then drag a line over the existing Blue Undergrounds
  4. All Red Belts are immediately placed as Ghosts, but also immediately created by the God.Revive function
  5. The Blue Underground will be marked for Upgrade to a Red
  6. On a later Tick, the God.Upgrade function will place the Red Underground
As you can see, my workaround basically involves delaying interacting with the Entity into a future Tick; I did not find any magic numbers here either, it seems that any delayed handling will work.

Log:

Code: Select all

 
   0.000 2022-04-15 17:53:33; Factorio 1.1.57 (build 59622, linux64, full)
   0.006 Operating system: Linux (Arch rolling)
   0.006 Program arguments: "/home/cameron/src/factorio/factorio/factorio" 
   0.006 Read data path: /home/cameron/src/factorio/factorio/data
   0.006 Write data path: /home/cameron/src/factorio/factorio [218166/918880MB]
   0.006 Binaries path: /home/cameron/src/factorio/factorio/bin
   0.011 System info: [CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz, 20 cores, RAM: 128526 MB]
   0.011 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=i3 XDG_SESSION_DESKTOP=i3 XDG_CURRENT_DESKTOP=i3 __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.011 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
   0.079 Available displays: 1
   0.079  [0]: LG HDR 4K 27" - {[0,0], 3840x2160, SDL_PIXELFORMAT_RGB888, 60Hz}
   0.104 Initialised OpenGL:[0] NVIDIA GeForce RTX 3080/PCIe/SSE2; driver: 3.3.0 NVIDIA 510.54
   0.104   [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
   0.104   [Version] 3.3
   0.104 Graphics settings preset: very-high
   0.104   Dedicated video memory size 10240 MB
   0.127 Graphics options: [Graphics quality: high] [Video memory usage: all] [DXT: high-quality] [Color: 32bit]
   0.128                   [Max threads (load/render): 32/20] [Max texture size: 0] [Tex.Stream.: 0] [Rotation quality: normal] [Other: STDCWT] [B:0,C:0,S:100]
   0.132 [Audio] Backend:default; Depth:16, Channel:2, Frequency:44100; MixerQuality:linear
   0.324 Loading mod settings blueprint-sandboxes 1.3.0 (settings.lua)
   0.325 Loading mod core 0.0.0 (data.lua)
   0.375 Loading mod base 1.1.57 (data.lua)
   0.585 Loading mod blueprint-sandboxes 1.3.0 (data.lua)
   0.668 Loading mod base 1.1.57 (data-updates.lua)
   0.783 Loading mod blueprint-sandboxes 1.3.0 (data-updates.lua)
   0.906 Loading mod blueprint-sandboxes 1.3.0 (data-final-fixes.lua)
   1.049 Checksum for core: 1636702648
   1.049 Checksum of base: 1844968960
   1.049 Checksum of blueprint-sandboxes: 2301822881
   1.288 Prototype list checksum: 2332737440
   1.357 Loading sounds...
   1.394 Info PlayerData.cpp:71: Local player-data.json available, timestamp 1650066587
   1.394 Info PlayerData.cpp:78: Cloud player-data.json unavailable
   1.515 Initial atlas bitmap size is 16384
   1.546 Created atlas bitmap 16384x16372 [none]
   1.549 Created atlas bitmap 16384x13236 [none]
   1.549 Created atlas bitmap 8192x4188 [decal]
   1.549 Created atlas bitmap 16384x5568 [low-object]
   1.550 Created atlas bitmap 8192x4416 [mipmap, linear-minification, linear-magnification, linear-mip-level]
   1.550 Created atlas bitmap 16384x6064 [terrain, mipmap, linear-minification, linear-mip-level]
   1.550 Created atlas bitmap 4096x3216 [terrain-effect-map, mipmap, linear-minification, linear-mip-level]
   1.550 Created atlas bitmap 4096x1840 [smoke, mipmap, linear-minification, linear-magnification]
   1.550 Created atlas bitmap 4096x3088 [mipmap]
   1.550 Created atlas bitmap 8192x2240 [icon, not-compressed, mipmap, linear-minification, linear-magnification, linear-mip-level]
   1.551 Created atlas bitmap 8192x1496 [alpha-mask]
   1.554 Created atlas bitmap 16384x14768 [shadow, linear-magnification, alpha-mask]
   1.554 Created atlas bitmap 8192x2352 [shadow, mipmap, linear-magnification, alpha-mask]
   1.554 Created atlas bitmap 2048x240 [icon-background, not-compressed, mipmap, linear-minification, linear-magnification, linear-mip-level, ]
   1.561 Texture processor created (2048). GPU accelerated compression Supported: yes, Enabled: yes/yes. Test passed. YCoCgDXT PSNR: 35.83, BC3 PSNR: 33.82
   2.037 Parallel Sprite Loader initialized (threads: 19)
   7.444 Sprites loaded
   7.455 Generated mipmaps (4) for atlas [3] of size 16384x5568   
   7.457 Generated mipmaps (3) for atlas [4] of size 8192x4416   
   7.472 Generated mipmaps (3) for atlas [5] of size 16384x6064   
   7.476 Generated mipmaps (3) for atlas [6] of size 4096x3216   
   7.479 Generated mipmaps (3) for atlas [7] of size 4096x1840   
   7.515 Generated mipmaps (3) for atlas [8] of size 4096x3088   
   7.533 Generated mipmaps (5) for atlas [9] of size 8192x2240   
   7.535 Generated mipmaps (3) for atlas [12] of size 8192x2352   
   7.569 Custom mipmaps uploaded.
   7.597 Custom inputs active: 1
   7.679 Factorio initialised
  10.780 Loading map /home/cameron/src/factorio/factorio/saves/ghost-belt-crash.zip: 846110 bytes.
  10.788 Loading level.dat: 5707531 bytes.
  10.791 Info Scenario.cpp:199: Map version 1.1.57-1
  10.838 Loading script.dat: 1901 bytes.
  10.840 Checksum for script /home/cameron/src/factorio/factorio/temp/currently-playing/control.lua: 3795083680
  10.842 Checksum for script __blueprint-sandboxes__/control.lua: 1944519167
  87.763 Loading map /home/cameron/src/factorio/factorio/saves/ghost-belt-crash.zip: 846110 bytes.
  87.772 Loading level.dat: 5707531 bytes.
  87.774 Info Scenario.cpp:199: Map version 1.1.57-1
  87.827 Loading script.dat: 1901 bytes.
  87.828 Checksum for script /home/cameron/src/factorio/factorio/temp/currently-playing/control.lua: 3795083680
  87.830 Checksum for script __blueprint-sandboxes__/control.lua: 1944519167
  94.887 Error CrashHandler.cpp:635: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
/tmp/factorio-build-s2MpP5/src/Util/Logger.cpp (313): Logger::writeStacktrace(FileWriteStream*, StackTraceInfo*)
/tmp/factorio-build-s2MpP5/src/Util/Logger.cpp (322): Logger::logStacktrace(StackTraceInfo*)
/tmp/factorio-build-s2MpP5/src/Util/CrashHandler.cpp (184): CrashHandler::writeStackTrace(CrashHandler::CrashReason)
/tmp/factorio-build-s2MpP5/src/Util/CrashHandler.cpp (636): CrashHandler::commonSignalHandler(int)
/tmp/factorio-build-s2MpP5/src/Util/CrashHandler.cpp (642): CrashHandler::SignalHandler(int)
0x7f99cac8c55f
/tmp/factorio-build-s2MpP5/src/CommonManualBuilder.cpp (1477): CommonManualBuilder::setLastBuiltEntityByOverbuild(BuildInput const&, BuildSettings const&, Entity*)
/tmp/factorio-build-s2MpP5/src/CommonManualBuilder.cpp (1369): CommonManualBuilder::checkOverbuild(BuildInput const&, BuildSettings const&, Entity*)
/tmp/factorio-build-s2MpP5/src/CommonManualBuilder.cpp (690): CommonManualBuilder::createGhost(BuildInput const&, BuildSettings const&, Item const*, NamedBool<ForcedGhostModeTag>)
/tmp/factorio-build-s2MpP5/src/CommonManualBuilder.cpp (166): CommonManualBuilder::buildCommon(agui::GenericTargeter<ManualBuilder>&, BuildInput&, BuildSettings const&, MapPosition const&)
/tmp/factorio-build-s2MpP5/src/ManualBuilder.cpp (345): ManualBuilder::build(MapTickType, ActionData::BuildParameters const&, ForceID, BuildSettings, UndoItem*)
/tmp/factorio-build-s2MpP5/src/Controller/GodController.cpp (905): GodController::build(ActionData::BuildParameters const&)
/tmp/factorio-build-s2MpP5/src/GameActionHandler.cpp (741): GameActionHandler::build(InputAction const&, Controller*)
/tmp/factorio-build-s2MpP5/src/GameActionHandler.cpp (367): GameActionHandler::actionPerformed(InputAction const&)
/tmp/factorio-build-s2MpP5/src/Input/InputHandler.cpp (72): InputHandler::flushToListeners(InputAction const&, bool)
/tmp/factorio-build-s2MpP5/src/Input/InputHandler.cpp (64): InputHandler::flushActions(bool, MapTickType)
/tmp/factorio-build-s2MpP5/src/GameActionHandler.cpp (410): GameActionHandler::update()
/tmp/factorio-build-s2MpP5/src/MainLoop.cpp (1244): MainLoop::gameUpdateStep(MultiplayerManagerBase*, Scenario*, AppManager*, MainLoop::HeavyMode) [clone .isra.0]
/tmp/factorio-build-s2MpP5/src/MainLoop.cpp (1107): MainLoop::gameUpdateLoop(MainLoop::HeavyMode)
/home/build/gcc-11.2/include/c++/11.2.0/bits/std_function.h (560): std::function<void ()>::operator()() const
/tmp/factorio-build-s2MpP5/src/Util/WorkerThread.cpp (48): WorkerThread::loop()
../../../../../libstdc++-v3/src/c++11/thread.cc (82): execute_native_thread_routine
start_thread
__clone
0xffffffffffffffff
Stack trace logging done
  95.042 Error CrashHandler.cpp:191: Map tick at moment of crash: 7047
  95.042 Error Util.cpp:97: 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.
 105.772 Uploading log file
 105.798 Info SystemUtil.cpp:564: Started /home/cameron/src/factorio/factorio/bin/x64/factorio; trampoline PID: 2792008
Attachments
ghost-belt-crash.zip
(826.28 KiB) Downloaded 99 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14476
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.57] Crash on overbuild with script

Post by Rseding91 »

Thanks for the report. It's now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”