Download

Dedicated server crash with "Windows GetLastError". Windows event viewer detail: KERNELBASE.dll

Hello everybody,

I’m currently working on an online multiplayer game using AWS GameLift. Everything worked fine until I added a SetTimer in a GameMode GameLift callback (OnStartGameSession).



void AgmodeDM::OnStartGameSession_GameLift(Aws::GameLift::Server::Model::GameSession gameSession) {
#if WITH_GAMELIFT FString Json = gameSession.GetMatchmakerData();
TSharedPtr<FJsonObject> JsonObject;
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Json);

if (FJsonSerializer::Deserialize(Reader, JsonObject) && JsonObject->HasField("teams")) {
  [INDENT=2]const TArray<TSharedPtr<FJsonValue>> Arr_Teams = JsonObject->GetArrayField("teams");

for (int i = 0; i < Arr_Teams.Num(); i++) {[/INDENT]
  [INDENT=3]const TSharedPtr<FJsonObject> TeamJsonObject = Arr_Teams*->AsObject();
const TArray<TSharedPtr<FJsonValue>> Arr_Players = TeamJsonObject->GetArrayField("players");
for (int j = 0; j < Arr_Players.Num(); j++) {[/INDENT]
  [INDENT=4]this->Arr_PlayerDatas.Add(FPlayerData(*Arr_Players[j]->AsObject().Get()));[/INDENT]
  [INDENT=3]}[/INDENT]
  [INDENT=2]}[/INDENT]
  }

// Line below cause the crash
GetWorld()->GetTimerManager().SetTimer(
  [INDENT=2]ShutdownTimerHandle,
FTimerDelegate::CreateUObject([/INDENT]
  [INDENT=3]this,
&AgmodeDM::Toto),[/INDENT]
  [INDENT=2]this->fWaitPlayersToJoinTime,
false);[/INDENT]
  
Aws::GameLift::Server::ActivateGameSession();
 #endif
}


You’ll find below all the things I tried/found to remove the error:

  1. The line causing the crash execute properly in the GameMode begin play function (within or whithout WITH_GAMELIFT)
  2. I tried to recompile everything without success
  3. I copied/pasted the .pdb to dedicated server to add some stack trace in the log, but sadly nothing more in it.

There’s no so much resources on this kind of error thus I decided to open a post here to find some help :slight_smile:

Thanks