Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dondaCD opened this issue Jan 14, 2025 · 1 comment · Fixed by #857
Closed

Comments

@dondaCD
Copy link

dondaCD commented Jan 14, 2025

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.

@tustanivsky
Copy link
Collaborator

@dondaCD Thank you for bringing this up.

Since USentryId is part of the public API switching to a struct could break backward compatibility with older plugin versions so this decision needs careful consideration. At the very least, we can follow the same approach used for USentryEvent to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Archived in project
2 participants