Fix Unreal heartbeat response parsing delays caused by incorrect completion and status checks - #196
Draft
Dimitris Gkanatsios (dgkanatsios) with Copilot wants to merge 3 commits into
Draft
Fix Unreal heartbeat response parsing delays caused by incorrect completion and status checks#196Dimitris Gkanatsios (dgkanatsios) with Copilot wants to merge 3 commits into
Dimitris Gkanatsios (dgkanatsios) with Copilot wants to merge 3 commits into
Conversation
Copilot started work on behalf of
Dimitris Gkanatsios (dgkanatsios)
March 3, 2026 19:39
View session
…ck with request status check and fix response code validation The ReceiveHeartbeat() method had two bugs: 1. Content length check compared string character count with HTTP byte count, which fails for non-ASCII UTF-8 or chunked transfer encoding, silently dropping valid responses. 2. Response code check only rejected >= 300, allowing code 0 (connection failures) through to JSON parsing of empty bodies. Fix: Use EHttpRequestStatus to properly detect completed requests, check response code is in 200-299 range, and guard against empty response bodies. Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
…ature queue removal Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Unreal Heart Beat successful parsing delay
Fix Unreal heartbeat response parsing delays caused by incorrect completion and status checks
Mar 3, 2026
Copilot started reviewing on behalf of
Dimitris Gkanatsios (dgkanatsios)
August 7, 2026 01:51
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the Unreal GSDK heartbeat receive path to avoid silently dropping or mis-processing heartbeat responses, which can delay session config/metadata population (sessionId, metadata, etc.) during server startup.
Changes:
- Stop iterating heartbeat requests when an earlier request is still incomplete to avoid incorrect
killIndex-based removals. - Replace the string-length vs content-length check with request completion/status checks.
- Treat only HTTP 2xx as success and skip JSON decoding on empty bodies.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| UnrealPlugin/Source/PlayFabGSDK/Private/GSDKInternal.cpp | Fixes Unreal heartbeat response processing (completion/status gating, 2xx-only validation, empty-body guard). |
| UnrealPlugin/TestingProject/Plugins/PlayFabGSDK/Source/PlayFabGSDK/Private/GSDKInternal.cpp | Mirrors the same heartbeat fixes in the TestingProject plugin copy. |
Comment on lines
+264
to
268
| if (Response->GetResponseCode() < 200 || Response->GetResponseCode() >= 300) | ||
| { | ||
| UE_LOG(LogPlayFabGSDK, Error, TEXT("Received non-success code from Agent. Status Code: %d Response Body: %s"), Response->GetResponseCode(), *Response->GetContentAsString()); | ||
| continue; | ||
| } |
Comment on lines
+264
to
268
| if (Response->GetResponseCode() < 200 || Response->GetResponseCode() >= 300) | ||
| { | ||
| UE_LOG(LogPlayFabGSDK, Error, TEXT("Received non-success code from Agent. Status Code: %d Response Body: %s"), Response->GetResponseCode(), *Response->GetContentAsString()); | ||
| continue; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
ReceiveHeartbeat()has two bugs that cause heartbeat responses to be silently dropped or incorrectly processed, delaying session config population (sessionId, metadata, etc.) by up to ~10 minutes.Bug 1: Content length check compares incompatible units
FString::Len()returns character count;GetContentLength()returns byte count. These diverge with non-ASCII UTF-8 or chunked transfer encoding (noContent-Lengthheader), silently dropping valid responses. No other SDK (C#, C++, Java) performs this check.Bug 2: Response code 0 passes the error check
Connection failures yield response code 0 with an empty body. This reaches
DecodeHeartbeatResponse(""), which fails JSON parsing and logs "Failed to parse heartbeat" every cycle.Fix:
EHttpRequestStatuscompletion detectionbreak(notcontinue) for incomplete requests — thekillIndex-based removal deletes entries0..killIndex, so skipping an incomplete request at index N while processing index N+1 would incorrectly remove the incomplete oneSpecial notes for your reviewer:
Both the source copy (
UnrealPlugin/Source/) and the TestingProject copy (UnrealPlugin/TestingProject/Plugins/) are updated identically. Unreal automation tests require the Editor and have no CI workflow, so changes were verified by code inspection and cross-referenced against C#/C++/Java SDK heartbeat handling.If applicable:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.