porisius/FicsitRemoteMonitoring

Crash on `/getProdStats`

Opened this issue · 6 comments

Hi!

Similar to the issue #80, I am getting a crash when accessing a route.
For me the game crashes on /getProdStats.

Here is the stack trace:

Version: 368883, IsEditor: No, IsPerforceBuild: No, BuildConfiguration: Shipping, Launcher: Steam, NetMode: Listen Server, IsUsingMods: Yes, IsSaveGameEdited: No

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000000

FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!UFRM_Production::getProdStats() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\FicsitRemoteMonitoring\Private\FRM_Production.cpp:68]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!AFicsitRemoteMonitoring::execgetProdStats() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Intermediate\Build\Win64\FactoryGameSteam\Inc\FicsitRemoteMonitoring\UHT\FicsitRemoteMonitoring.gen.cpp:396]
FactoryGameSteam_CoreUObject_Win64_Shipping!UFunction::Invoke() [C:\BuildAgent\work\b731a33f2a691e17\UE4\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6666]
FactoryGameSteam_CoreUObject_Win64_Shipping!UObject::ProcessEvent() [C:\BuildAgent\work\b731a33f2a691e17\UE4\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:2161]
FactoryGameSteam_Engine_Win64_Shipping!AActor::ProcessEvent() [C:\BuildAgent\work\b731a33f2a691e17\UE4\Engine\Source\Runtime\Engine\Private\Actor.cpp:1175]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!AFicsitRemoteMonitoring::CallEndpoint() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\FicsitRemoteMonitoring\Private\FicsitRemoteMonitoring.cpp:583]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!AFicsitRemoteMonitoring::HandleEndpoint() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\FicsitRemoteMonitoring\Private\FicsitRemoteMonitoring.cpp:596]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!AFicsitRemoteMonitoring::HandleApiRequest() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\FicsitRemoteMonitoring\Private\FicsitRemoteMonitoring.cpp:362]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!``AFicsitRemoteMonitoring::StartWebSocketServer'::`2'::<lambda_1>::operator()'::`3'::<lambda_8>::operator()<uWS::HttpResponse<0>,uWS::HttpRequest>() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\FicsitRemoteMonitoring\Private\FicsitRemoteMonitoring.cpp:195]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!ofats::any_detail::handler_traits<bool,uWS::HttpRouter<uWS::HttpContextData<0>::RouterData> *>::large_handler<`uWS::HttpContext<0>::onHttp'::`2'::<lambda_1> >::call() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\ThirdParty\uWebSockets\MoveOnlyFunction.h:152]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!uWS::HttpRouter<uWS::HttpContextData<0>::RouterData>::executeHandlers() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\ThirdParty\uWebSockets\HttpRouter.h:188]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!``uWS::HttpContext<0>::init'::`2'::<lambda_3>::operator()'::`2'::<lambda_1>::operator()() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\ThirdParty\uWebSockets\HttpContext.h:177]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!uWS::HttpParser::fenceAndConsumePostPadded<0>() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\ThirdParty\uWebSockets\HttpParser.h:514]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!uWS::HttpParser::consumePostPadded() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\ThirdParty\uWebSockets\HttpParser.h:698]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!`uWS::HttpContext<0>::init'::`2'::<lambda_3>::operator()() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\ThirdParty\uWebSockets\HttpContext.h:143]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!us_internal_dispatch_ready_poll() [A:\workspace\vcpkg\buildtrees\usockets\src\v0.8.8-af4482ba56.clean\src\loop.c:358]
uv
uv
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!`AFicsitRemoteMonitoring::StartWebSocketServer'::`2'::<lambda_1>::operator()() [A:\workspace\SatisfactoryModLoader\Mods\FicsitRemoteMonitoring\Source\FicsitRemoteMonitoring\Private\FicsitRemoteMonitoring.cpp:213]
FactoryGameSteam_FicsitRemoteMonitoring_Win64_Shipping!TAsyncRunnable<void>::Run() [A:\Unreal Engine - CSS\Engine\Source\Runtime\Core\Public\Async\Async.h:457]
FactoryGameSteam_Core_Win64_Shipping!FRunnableThreadWin::Run() [C:\BuildAgent\work\b731a33f2a691e17\UE4\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:149]

Looking through the code, it seems that an "ResourceClass" might be NULL:

TScriptInterface<IFGExtractableResourceInterface> ResourceClass = Extractor->GetExtractableResource();
TSubclassOf<UFGResourceDescriptor> ItemClass = ResourceClass->GetResourceClass();

The save was created prior to 1.0, so could this be a regression due to that?

Let me know if a simple "if null then continue" check should be sufficient and I can open a PR for it.

Yeah, that sounds like it to me as well, and you're welcome to PR a fix up. I do have some uncommitted code for the websockets side because it is a WIP if you run into errors, compiling.

I wouldn't ask for someone go through setting up the whole modding environment to test 1-2 lines of code. If you don't and don't wish to, I can release a test build to see if that issue is resolved however.

I appreciate you bringing this to my attention though.

Actually, I'll get it... you just told me that getExtractor would be an issue too...

May you please test this build (Google Drive Link) for me and see if that issue clears up? Also, please confirm getExtractor, I would be most appreciated.

Sorry, Github only allows 25MB, and a full release build is ~150MB.
https://drive.google.com/drive/folders/1jjzIE8eczElSeoCFCg0weJeJw7fALpnc?usp=sharing

Awesome, thanks for the really quick fix!

I have tried your updated version now and I no longer get the crash on /getProdStats

If you don't mind me asking, what about getExtractor, since it uses just about the same code?

Right sorry, I checked that too just forgot to include that in the reply.

/getExtractor works great too :)