[1.1.53] race click on scenario-closed bp-lib gui: crashes client if latency>0.
Posted: Wed Feb 16, 2022 1:22 am
by KeepResearchinSpoons
[1.1.53] race click on scenario-closed bp-lib gui crashes client with latency>0.
Hello, me again. Blueprints crashing the engine again. With latency. Deja vu, have I seen that stacktrace before... :>
((I shall update this with steps/mwe/lua stuff in a moment, pls bear with me, *life* is happening :> ))
Rating?; A bit of "off-topic";
Nah, you have to go outta the way to do it. Or so I thought.
The issue is deeper than it looks in the stacktrace's surface.
There are a lot of 50/50 on the idiomatic level.
Take, say, "moving" a stack. Probably shall give it 1 to 6 to do it right from the get go. That is excluding the issue of being able to do that at all.
Simple task you think? Right?
Guess how many implementations will not respect bullet count in ammo? Let alone gear in mk2/fish-tanks... Markets, virtual ("ender") personal (force level) storages! Spare me the crafting que, cuz that one is nasty.
This is not as out-of-scope as I would want it to be, sadly. Maybe a simple write-up on that one is also a good idea.. and thus me here.
This time the naive way just caused a crash and not the item-dupe/race-in-lua/desync-in-mp/anything.
Thus, there are 2 good points to cover with one report: (bug + context). And me motivated enough to put in the effort tries to be helpful, kappa.
WHAT?
When misused, scenario code may cause (looks like a race. maybe) that could crash client on bp gui click.
Needs to have latency, so that gui flashes" around.
Maybe flashing itself is a bug. But I hardly see it as one, have not looked at the lua code as of yet, tho.
HOW?
scenario mis-implemented the permission for "no bp lib" as in "close it when it pops up".
When you actually click it the game crashes/player disconnects.
This was in the community with history, that you have probably even heard of, yikes. Not just a random party of newbies. Ofc told them the /permissions way, but do you see it charming they even made that this way and ran for a while in the first place?
Here is a simple compilation of stack-traces, if it helps.
3921.925 Deleting surface battle_surface_1 index 2.
6217.019 Error CrashHandler.cpp:633: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
Raw stacktrace: 0xa18877, 0xa18f4d, 0xd78fa5, 0xd79a41, 0xd79af9, 0x46210, 0xd9b173, 0xfbba41, 0x139eec5, 0x139f215, 0xa1d051, 0x20bfe40, 0x9609, 0
6227.213 Warning Logger.cpp:526: Symbols.size() == 22, usedSize == 13
#0 0x0000000000a18f4d in std::__uniq_ptr_impl<LoggerFileWriteStream, std::default_delete<LoggerFileWriteStream> >::_M_ptr() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:154
#1 0x0000000000d78fa5 in std::unique_ptr<LoggerFileWriteStream, std::default_delete<LoggerFileWriteStream> >::get() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:353
#2 0x0000000000d79a41 in std::unique_ptr<LoggerFileWriteStream, std::default_delete<LoggerFileWriteStream> >::operator->() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:347
#3 0x0000000000d79af9 in Logger::flush() at /tmp/factorio-build-Tm8QJQ/src/Util/Logger.cpp:566
#4 0x0000000000046210 in Logger::logStacktrace(StackTraceInfo*) at /tmp/factorio-build-Tm8QJQ/src/Util/Logger.cpp:552
#5 0x0000000000d9b173 in GlobalContext::getMap() at /tmp/factorio-build-Tm8QJQ/src/GlobalContext.cpp:2052
#6 0x0000000000fbba41 in CrashHandler::writeStackTrace(CrashHandler::CrashReason) at /tmp/factorio-build-Tm8QJQ/src/Util/CrashHandler.cpp:188
#7 0x000000000139eec5 in CrashHandler::commonSignalHandler(int) at /tmp/factorio-build-Tm8QJQ/src/Util/CrashHandler.cpp:635
#8 0x000000000139f215 in CrashHandler::SignalHandler(int) at /tmp/factorio-build-Tm8QJQ/src/Util/CrashHandler.cpp:650
#9 0x0000000000a1d051 in ?? at ??:0
#10 0x00000000020bfe40 in LatencyInputHandler::grabBlueprintRecord(InputAction const&, Player*) at /tmp/factorio-build-Tm8QJQ/src/LatencyInputHandler.cpp:291
#11 0x0000000000009609 in LatencyInputHandler::actionPerformed(InputAction const&) at /tmp/factorio-build-Tm8QJQ/src/LatencyInputHandler.cpp:994
#12 (nil) in LatencyInputHandler::update() at /tmp/factorio-build-Tm8QJQ/src/LatencyInputHandler.cpp:1026
#13 (nil) in MainLoop::gameUpdateStep(MultiplayerManagerBase*, Scenario*, AppManager*, MainLoop::HeavyMode) at /tmp/factorio-build-Tm8QJQ/src/MainLoop.cpp:1269
#14 0x00fffa1c00000000 in MainLoop::gameUpdateLoop(MainLoop::HeavyMode) at /tmp/factorio-build-Tm8QJQ/src/MainLoop.cpp:1108
#15 0x00000000ffffffff in std::function<void ()>::operator=(decltype(nullptr)) at /home/build/gcc-9.2/include/c++/9.2.0/bits/std_function.h:498
#16 0x00007f377789a8e9 in WorkerThread::loop() at /tmp/factorio-build-Tm8QJQ/src/Util/WorkerThread.cpp:49
#17 0x0000003000000000 in std::default_delete<std::thread::_State>::operator()(std::thread::_State*) const at /home/build/gcc-9.2-source/gcc-9.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:81
#18 0x00007f37530b53e0 in std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >::~unique_ptr() at /home/build/gcc-9.2-source/gcc-9.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:284
#19 0xffffffffffffffff in execute_native_thread_routine at /home/build/gcc-9.2-source/gcc-9.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../libstdc++-v3/src/c++11/thread.cc:79
#20 0x00007f37530b4d91 in ?? at ??:0
#21 0x00007f37778e9360 in ?? at ??:0
Stack trace logging done
6235.776 Warning Logger.cpp:526: Symbols.size() == 17, usedSize == 12
6235.776 Error CrashHandler.cpp:189: Map tick at moment of crash: 875573
6235.776 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.
6240.618 Info SystemUtil.cpp:554: Started /usr/bin/xdg-open; trampoline PID: 3729689
PlayerJoinGame peerID(22) playerIndex(7) mode(connect)
40.247 Info ClientSynchronizer.cpp:335: Latency changed to (48)
44.081 Error CrashHandler.cpp:633: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
Raw stacktrace: 0xa18877, 0xa18f4d, 0xd78fa5, 0xd79a41, 0xd79af9, 0x46210, 0xd9b173, 0xfbba41, 0x139eec5, 0x139f215, 0xa1d051, 0x20bfe40, 0x9609, 0
52.554 Warning Logger.cpp:526: Symbols.size() == 22, usedSize == 13
#0 0x0000000000a18f4d in std::__uniq_ptr_impl<LoggerFileWriteStream, std::default_delete<LoggerFileWriteStream> >::_M_ptr() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:154
#1 0x0000000000d78fa5 in std::unique_ptr<LoggerFileWriteStream, std::default_delete<LoggerFileWriteStream> >::get() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:353
#2 0x0000000000d79a41 in std::unique_ptr<LoggerFileWriteStream, std::default_delete<LoggerFileWriteStream> >::operator->() const at /home/build/gcc-9.2/include/c++/9.2.0/bits/unique_ptr.h:347
#3 0x0000000000d79af9 in Logger::flush() at /tmp/factorio-build-Tm8QJQ/src/Util/Logger.cpp:566
#4 0x0000000000046210 in Logger::logStacktrace(StackTraceInfo*) at /tmp/factorio-build-Tm8QJQ/src/Util/Logger.cpp:552
#5 0x0000000000d9b173 in GlobalContext::getMap() at /tmp/factorio-build-Tm8QJQ/src/GlobalContext.cpp:2052
#6 0x0000000000fbba41 in CrashHandler::writeStackTrace(CrashHandler::CrashReason) at /tmp/factorio-build-Tm8QJQ/src/Util/CrashHandler.cpp:188
#7 0x000000000139eec5 in CrashHandler::commonSignalHandler(int) at /tmp/factorio-build-Tm8QJQ/src/Util/CrashHandler.cpp:635
#8 0x000000000139f215 in CrashHandler::SignalHandler(int) at /tmp/factorio-build-Tm8QJQ/src/Util/CrashHandler.cpp:650
#9 0x0000000000a1d051 in ?? at ??:0
#10 0x00000000020bfe40 in LatencyInputHandler::grabBlueprintRecord(InputAction const&, Player*) at /tmp/factorio-build-Tm8QJQ/src/LatencyInputHandler.cpp:291
#11 0x0000000000009609 in LatencyInputHandler::actionPerformed(InputAction const&) at /tmp/factorio-build-Tm8QJQ/src/LatencyInputHandler.cpp:994
#12 (nil) in LatencyInputHandler::update() at /tmp/factorio-build-Tm8QJQ/src/LatencyInputHandler.cpp:1026
#13 (nil) in MainLoop::gameUpdateStep(MultiplayerManagerBase*, Scenario*, AppManager*, MainLoop::HeavyMode) at /tmp/factorio-build-Tm8QJQ/src/MainLoop.cpp:1269
#14 0x0000000000000007 in MainLoop::gameUpdateLoop(MainLoop::HeavyMode) at /tmp/factorio-build-Tm8QJQ/src/MainLoop.cpp:1108
#15 0x00000001ffffffff in std::function<void ()>::operator=(decltype(nullptr)) at /home/build/gcc-9.2/include/c++/9.2.0/bits/std_function.h:498
#16 0x00007f0cd464e8e9 in WorkerThread::loop() at /tmp/factorio-build-Tm8QJQ/src/Util/WorkerThread.cpp:49
#17 0x0000003000000022 in std::default_delete<std::thread::_State>::operator()(std::thread::_State*) const at /home/build/gcc-9.2-source/gcc-9.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:81
#18 0x00007f0cab8593e0 in std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >::~unique_ptr() at /home/build/gcc-9.2-source/gcc-9.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:284
#19 0x0000000003f6f19c in execute_native_thread_routine at /home/build/gcc-9.2-source/gcc-9.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../libstdc++-v3/src/c++11/thread.cc:79
#20 0x00007f0cab858d91 in ?? at ??:0
#21 0x00007f0cd469d360 in ?? at ??:0
Stack trace logging done
60.911 Warning Logger.cpp:526: Symbols.size() == 17, usedSize == 12
60.911 Error CrashHandler.cpp:189: Map tick at moment of crash: 885228
60.911 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.
63.266 Info SystemUtil.cpp:554: Started /usr/bin/xdg-open; trampoline PID: 3732991
The same as before, it needs to have latency (basically, local host, but NOT host-game-on-client-itself).
I have had a solid repro. Gonna dig through lua to get you minimal working example.
Sorry, not recording a vid poc this time, too lazy to edit stuff rn.
I have both a scenario's save and full logs at hand.
Not gonna share them forums public since both might prob contain some not-for-public stuff (like bp --verbose exports or chat logs of 3rd parties or smth else).
Ofc, I have no src access. so the race in gui is as good guess as any :> Good luck with the traces, more info is coming up. Soon[tm]
Also, while discussing with an admin the said issue, the other player repro-ed it in with the crash. They probably had autosend on, (also maybe it was windows?) so you might have got one full log on the issue by now (less than half a day from this moment). And that also confirms that it is not my setup, which is cool. Yay. Gonna say "alt-f4for the dark-mode" cat never looses too much time, right?
Re: [1.1.53] race click on scenario-closed bp-lib gui: crashes client if latency>0.
Posted: Tue Apr 26, 2022 3:49 pm
by Rseding91
Thanks for the report. It's now fixed for the next release.