Skip to content

Crash from SentryConvertorsDesktop::SentryIdToUnreal when logging outside of gamethread #736

Closed
@dondaCD

Description

@dondaCD

Environment

How do you use Sentry?
Sentry SaaS (sentry.io)

Which version of the SDK?
Release 0.21.0

How did you install the package? (Git-URL, Assetstore)
Git

Which version of Unreal?
5.4.4

Is this happening in Unreal (editor) or on a player like Android, iOS, Windows?
In editor (but will probably reproduce on all platforms)

Steps to Reproduce

This root cause of this issue is identical to #573. On a thread that isn't the gamethread, log a warning or higher while the main thread is garbage collecting causes a crash. Callstack below should help with more details.

Expected Result

Crash should not happen

Actual Result

Results in a crash when launching the editor

Any logs or screenshots

Call stack:

Assertion failed: !IsGarbageCollectingAndLockingUObjectHashTables() [File:G:\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 3359] Unable to create new object: SentryId /Engine/Transient.None. Creating UObjects while Collecting Garbage is not allowed!

UnrealEditor_CoreUObject!StaticAllocateObject() [G:\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:3358]
UnrealEditor_CoreUObject!StaticConstructObject_Internal() [G:\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:4449]
UnrealEditor_Sentry_Win64_DebugGame!NewObject<USentryId>() [G:\Engine\Source\Runtime\CoreUObject\Public\UObject\UObjectGlobals.h:1764]
UnrealEditor_Sentry_Win64_DebugGame!SentryConvertorsDesktop::SentryIdToUnreal() [G:\Core\Plugins\ThirdParty\Sentry\Source\Sentry\Private\Desktop\Infrastructure\SentryConvertorsDesktop.cpp:148]
UnrealEditor_Sentry_Win64_DebugGame!SentrySubsystemDesktop::CaptureMessage() [G:\Core\Plugins\ThirdParty\Sentry\Source\Sentry\Private\Desktop\SentrySubsystemDesktop.cpp:368]
UnrealEditor_Sentry_Win64_DebugGame!USentrySubsystem::CaptureMessage() 
...

Suggested fix

Given the caveat that UObjects cannot be created during garbage collection, it seems like USentryId should really be a struct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions