Gamesparks Access Violation on AuthenticationRequest

Using 4.21.2, since upgrading from 4.21.1 my Gamesparks plugin is crashing with an Access Violation error:

Access violation - code c0000005 (first/second chance not available)
 
UE4Editor_GameSparks!GameSparks::Core::GS::NewConnection() [...\projects\spacealpha\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gs.cpp:116]
UE4Editor_GameSparks!GameSparks::Core::GS::Send() [...\projects\spacealpha\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gs.cpp:293]
UE4Editor_GameSparks!GameSparks::Core::GSTypedRequest<GameSparks::Api::Requests::RegistrationRequest,GameSparks::Api::Responses::RegistrationResponse>::Send() [...\projects\spacealpha\plugins\gamesparks\source\gamesparksbasesdk\include\gamesparks\gstypedrequest.h:85]
UE4Editor_GameSparks!UGSRegistrationRequest::Activate() [...\projects\spacealpha\plugins\gamesparks\source\gamesparks\private\gsapi.cpp:7181]

The plugin has been compiled from the latest GS repository version, https://bitbucket.org/gamesparks/gamesparks-cpp-unreal/downloads also https://docs.gamesparks.com/getting-started/creating-a-game/unreal-setup.html This happens when the Gamesparks AuthenticationRequest node is called from a widget, calling GameMode or a GameInstance Dispatcher. I tried with different clinet/server, no replication settings, without success. Prior to upgrading it was working.

Any pointers would be great, thanks.

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

Made a fresh project, unable to reproduce the error, it is something else, still investigating.

I was able to fix this, however it is unclear what exactly the problem was. It may be related to moving/renaming of the GameInstance or GameMode.

Steps I did which may have helped to resolved this:

  1. Avoiding GameInstance Dispatchers, calling GameMode Gamesparks connect function directly.
  2. Setting the Connect function to run only on the server, even though this should be per default I assume since GameMode only runs on the server?
  3. Added the Gamesparks function IsAuthenticated inbefore the GamesparkAuthenticationRequest node.
  4. Connecting to the server once the “MainMenu” has loaded entirely.
  5. Re-renaming and moving the GameInstance and GameMode, updating GameEngine.ini and Project Settings MapModes.
  6. Re-added the Gamesparkas component, added MessageListener.
  7. Changed a couple of delays on first order events.

Also tracked the issue down via Visual Studio:

This was the result from the debugger:

Exception thrown: read access violation.
this->**m_GSPlatform** was nullptr. occurred
 
Exception thrown: read access violation.
this->m_GSPlatform was nullptr.

  
C++

void GameSparks::Core::GS::DebugLog(const gsstl::string& message)
{
    GS_CODE_TIMING_ASSERT();
    m_GSPlatform->DebugMsg(message);
}

However, I re-added the GameInstance to share login data once the player switches the level, still working now. This problem might have been resolved when removing/readding the Gamesparks component or when renaming the GameInstance or GameMode.
268947-

So this problem happens when you try to connect with credentials, and provided credentials are invalid. This is a Gamespark issue, the Connect node should just output an error (not crash the editor).

This can be confusing, since when you login through a login/lobby map, then switch the map and gamemode, everything is fine (since authentication is cached per default). However, if you load the game map directly without at least one prior login/authentication, AccessViolation-crash happens, also happens after some time once the GS server discards cached authentications.

So while the built will require login through the lobby at first it is unclear how to exactly implement a login screen popup once authentication expired, if the player has to for instance reconnect. Maybe a check on credential strings if not empty, or store credentials inside the playerstate.