Hi there,
I've setup leaderboards which generally work great in UE4. However the engine is constantly crashing on me. It's usually with the GetLeaderboardAroundPlayer request (specicially the OnSuccess delegate).
It usually happens when I'm switching maps or stopping the game.
Here's the crash report:
LoginId:18ac774f461c9d008b6ef3a8d3229fcd EpicAccountId:cc542e79173a45cd814192dc7778d7ce Unhandled exception UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_PlayFab!UPlayFabClientAPI::FDelegateOnSuccessGetLeaderboardAroundPlayer_DelegateWrapper() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\playfab\source\playfab\classes\playfabclientapi.h:1725] UE4Editor_PlayFab!UPlayFabClientAPI::HelperGetLeaderboardAroundPlayer() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\playfab\source\playfab\private\playfabclientapi.cpp:6818] UE4Editor_PlayFab!UPlayFabClientAPI::execHelperGetLeaderboardAroundPlayer() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\playfab\source\playfab\classes\playfabclientapi.h:29] UE4Editor_CoreUObject UE4Editor_CoreUObject UE4Editor_PlayFab!TMulticastScriptDelegate<FWeakObjectPtr>::ProcessMulticastDelegate<UObject>() [d:\rocketsync\4.22.0-5660361+++ue4+release-4.22\working\engine\source\runtime\core\public\uobject\scriptdelegates.h:488] UE4Editor_PlayFab!FOnPlayFabClientRequestCompleted::Broadcast() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\playfab\source\playfab\classes\playfabclientapi.h:24] UE4Editor_PlayFab!UPlayFabClientAPI::OnProcessRequestComplete() [d:\build\++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\playfab\source\playfab\private\playfabclientapi.cpp:9377] UE4Editor_PlayFab!TBaseUObjectMethodDelegateInstance<0,UPlayFabClientAPI,void __cdecl(TSharedPtr<IHttpRequest,0>,TSharedPtr<IHttpResponse,1>,bool)>::ExecuteIfSafe() [d:\rocketsync\4.22.0-5660361+++ue4+release-4.22\working\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:677] UE4Editor_HTTP UE4Editor_HTTP UE4Editor_HTTP UE4Editor_Core UE4Editor UE4Editor UE4Editor UE4Editor UE4Editor kernel32 ntdll
Answer by Sarah Zhang · Jun 17, 2019 at 06:25 AM
I have tested this API that you provided in the UE4, and unable to reproduce the crash in my own project. Can you provide more info about your project? What are the version of UE4 and the version of SDK? Did you use blueprint or cpp? Also you can provide your error info to the UE4 forum for some help.
Hi Sarah.
I'm using the blueprint plugin and UE4.22.
I've discovered the crash occurs if the custom object Im passing with the request is garbage collected before a response is received.
Moving the Reques/Response code from Game Instance to Game Mode reduced the crashes significantly, however they do still occur occasionally.
The problem is I can't check if the pointer is valid for the custom object in the response. Any attempt to access it if it has been GC'd causes a crash, including Is valid and != Null. Is there a way around this?
Thanks
Exact same thing is happening to us. It's only because of this comment that we were able to discover what was going on.