-
-
Notifications
You must be signed in to change notification settings - Fork 46
check() failure/crash when logging warning+ outside of gamethread #573
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
Comments
@ElodieDJ Thank you for reaching out and comprehensively describing this issue! We've encountered the exact same problem recently which I believe was addressed in #559. Basically, this fix allows us to capture breadcrumbs without instantiating a new |
Thank you! That fix looks exactly like what I was thinking :-) I'll make sure to pull the new update to our integration of Sentry. Feel free to resolve this issue, since you've already fixed it. |
Environment
How do you use Sentry?
Sentry SaaS (sentry.io)
How did you install the package?
From github
Which version of Unreal?
5.4.1
Is this happening in Unreal (editor) or on a player like Android, iOS, Windows?
My example happened in editor, but this would happen on all platforms.
Steps to Reproduce
Reproduction: On a thread that isn't the gamethread, use UE_LOG() at Warning or higher severity while the main thread is garbage collecting. This timing makes it tricky to reproduce, but the call stack and code should be sufficient to explain the issue.
Expected Result
check() failure wouldn't happen, and there wouldn't be a crash.
Actual Result
This results in a check() failure, which causes a crash when not attached with a debugger.
Call stack:
Suggested fix
This is caused by the creation of
USentryBreadcrumb
from a logged warning+ message on a non-game thread, while the game thread is garbage collecting. Previously, Unreal didn't support creating objects outside of the game thread. While Unreal does now support creating objects (i.e. usingNewObject
) on threads that aren't the game thread, it's still not allowed during garbage collection. In addition, objects created outside of the game thread need to be specially managed (e.g. usingFGCCSyncObject
, clearingEInternalObjectFlags::Async
). More info on these requirements can be found on UDN, which I don't think I'm allowed to link to publicly.Given these caveats on using objects, it seems like
USentryBreadcrumb
should be replaced byTSharedPtr<FSentryBreadcrumb>
. This was the route I intended to go down, but decided to make a simpler change for now just to avoid the crash: don't create breadcrumbs during garbage collection. I did that by adding this snippet to the start ofUSentryLibrary::CreateSentryBreadcrumb()
andUSentrySubsystem::AddBreadcrumbWithParams()
:It seems like this would be a simple change to put in for now to fix the crash, and refactoring of breadcrumbs can be considered for the future.
The text was updated successfully, but these errors were encountered: