Page 1 of 1

[0.17.47] Desync & crash on odd "set_controller" call: "Sending input action via player which is not local."

Posted: Sun Jun 09, 2019 1:02 pm
by Anyone
While messing with the cutscenes we found odd behavior that would cause the entire server to crash, desync one of the players, crash the other and eventually halt the server.

How to reproduce:
  • Start a vanilla server
  • Join as player 1
  • Have a second player join
  • Player one executes this command:

    Code: Select all

    /c game.get_player(1).set_controller{ type=defines.controllers.character, character = game.get_player(2).character}
Stack trace (note that player 0 = player index 1 in the reproduction list)

Code: Select all

  36.922 Player 0 ran command: game.get_player(1).set_controller{ type=defines.controllers.character, character = game.get_player(2).character}
  37.172 Player 1 ran command: Debug.print(game.player.index)
  38.106 <server> ran command: local s = ServerCommands s = s and s.set_time(1560084842)
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-lpvbru\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-lpvbru\src\util\logger.cpp (383): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-lpvbru\src\util\logger.cpp (534): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-lpvbru\src\util\logging.cpp (96): Logging::logAndAbortOrThrow
c:\cygwin64\tmp\factorio-build-lpvbru\src\util\logging.cpp (90): Logging::logAndAbortOrThrow
c:\cygwin64\tmp\factorio-build-lpvbru\src\player.cpp (2119): Player::sendToListeners
c:\cygwin64\tmp\factorio-build-lpvbru\src\entity\entityselector.cpp (215): EntitySelector::checkIfEntitySelectionUpdateShouldBeCreated
c:\cygwin64\tmp\factorio-build-lpvbru\src\player.cpp (600): Player::updateEntitySelector
c:\cygwin64\tmp\factorio-build-lpvbru\src\input\inputhandlerallegro.cpp (1252): InputHandlerAllegro::sendStateChanges
c:\cygwin64\tmp\factorio-build-lpvbru\src\gameactionhandler.cpp (365): GameActionHandler::update
c:\cygwin64\tmp\factorio-build-lpvbru\src\mainloop.cpp (1149): MainLoop::gameUpdateStep
c:\cygwin64\tmp\factorio-build-lpvbru\src\mainloop.cpp (1022): MainLoop::gameUpdateLoop
c:\cygwin64\tmp\factorio-build-lpvbru\src\util\workerthread.cpp (42): WorkerThread::loop
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (230): std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl RouterBase::*)(void),ClientRouter *>,std::default_delete<std::tuple<void (__cdecl RouterBase::*)(void),ClientRouter *> > > >::_Go
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (209): std::_Pad::_Call_func
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp (115): thread_start<unsigned int (__cdecl*)(void * __ptr64)>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF86D607BD4)
00007FF86D607BD4 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF86DCCCE71)
00007FF86DCCCE71 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done

Re: [0.17.47] Desync & crash on odd "set_controller" call: "Sending input action via player which is not local."

Posted: Mon Jun 10, 2019 8:36 pm
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.17. That specific command isn't supposed to be valid - the character entity is owned by the player and it's meant to error the command saying so.

If you wanted to switch characters with someone there's the /swap-players command. Otherwise you first have to disassociate the character from the player before connecting to it.