You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
Especially noticeable in play-in-editor mode, UE crashes when the game/PIE is exited while a VaRest request is still running. The crash occurs in the response processing callback. More precisely here. When entering the if (ContinueAction) block, the pointer value of ContinueAction is copied into K, ContinueAction is set to nullptr and FVaRestLatentAction's Call method is invoked on the copied pointer value in K.
Impact: This shouldn't be too problematic for production releases as a crash during game exit often isn't noticeable. During development, this is productivity-killing.
Error analysis
I guess during game end, the garbage collector marks ContinueActions's underlying FVaRestLatentAction object as "pending delete". When setting ContinueAction to nullptr, the underlying FVaRestLatentAction object is destroyed as K is not a member variable but merely a scoped variable, nor is it a shared pointer. Therefore, K is a dangling pointer when reaching the final Call method call (so far my theory goes).
Solution attempt
I tried replacing the raw C++ pointer to FVaRestLatentAction with TSharedPtr and added a ContinueAction.IsValid() check in the surrounding if-block, but this led to memory allocation exceptions during normal operation. As I'm no UE expert, my knowledge about memory management in UE is limited and I cannot give any comprehensive insights into why.
Problem description
Especially noticeable in play-in-editor mode, UE crashes when the game/PIE is exited while a VaRest request is still running. The crash occurs in the response processing callback. More precisely here. When entering the
if (ContinueAction)
block, the pointer value ofContinueAction
is copied intoK
,ContinueAction
is set tonullptr
andFVaRestLatentAction
'sCall
method is invoked on the copied pointer value inK
.Error analysis
I guess during game end, the garbage collector marks
ContinueActions
's underlyingFVaRestLatentAction
object as "pending delete". When settingContinueAction
tonullptr
, the underlyingFVaRestLatentAction
object is destroyed asK
is not a member variable but merely a scoped variable, nor is it a shared pointer. Therefore,K
is a dangling pointer when reaching the finalCall
method call (so far my theory goes).Solution attempt
I tried replacing the raw C++ pointer to
FVaRestLatentAction
withTSharedPtr
and added aContinueAction.IsValid()
check in the surrounding if-block, but this led to memory allocation exceptions during normal operation. As I'm no UE expert, my knowledge about memory management in UE is limited and I cannot give any comprehensive insights into why.Final question
Any clue on how to fix this?
Error log:
The text was updated successfully, but these errors were encountered: