Skip to content
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

UE4 Asserts not captured on Android #1

Closed
bruno-garcia opened this issue Mar 18, 2022 · 7 comments · Fixed by #537
Closed

UE4 Asserts not captured on Android #1

bruno-garcia opened this issue Mar 18, 2022 · 7 comments · Fixed by #537

Comments

@bruno-garcia
Copy link
Member

No description provided.

@tustanivsky
Copy link
Collaborator

tustanivsky commented Mar 22, 2022

Unreal Engine plugin uses sentry-java in order to capture various events on Android. For some reason asserts are not captured even though other events and crashes are logged as expected.

Currently, the following packages are in use:

  • sentry-5.6.3
  • sentry-android-core-5.6.3
  • sentry-android-ndk-5.6.3

Here is the log captured with UE when assertion occurs:

Assertion failed: ptr != nullptr [File:/Users/itustanivsky/Work/UnrealProjects/Nineva/SentryUnrealDemo/Plugins/SentrySDK/Source/SentrySDK/Private/SentryLibrary.cpp] [Line: 14]
        Error: === Critical error: ===
        Assertion failed: ptr != nullptr [File:/Users/itustanivsky/Work/UnrealProjects/Nineva/SentryUnrealDemo/Plugins/SentrySDK/Source/SentrySDK/Private/SentryLibrary.cpp] [Line: 14]
        libUE4.so(0x00000000091B1D84)!FDebug::CheckVerifyFailedImpl(char const*, char const*, int, char16_t const*, ...)  []
        libUE4.so(0x0000000007EED52C)!USentryLibrary::Assert()  []
        libUE4.so(0x0000000009839C00)!UObject::execCallMathFunction(UObject*, FFrame&, void*)  []
        libUE4.so(0x000000000983C1EC)!ProcessLocalScriptFunction(UObject*, FFrame&, void*)  []
        libUE4.so(0x000000000983BB84)!void ProcessScriptFunction<void (*)(UObject*, FFrame&, void*)>(UObject*, UFunction*, FFrame&, void*, void (*)(UObject*, FFrame&, void*))  []
        libUE4.so(0x000000000983D0CC)!ProcessLocalFunction(UObject*, UFunction*, FFrame&, void*)  []
        libUE4.so(0x000000000983C1EC)!ProcessLocalScriptFunction(UObject*, FFrame&, void*)  []
        libUE4.so(0x000000000983BEE8)!UObject::ProcessInternal(UObject*, FFrame&, void*)  []
        libUE4.so(0x0000000009640580)!UFunction::Invoke(UObject*, FFrame&, void*)  []
        libUE4.so(0x0000000009841BAC)!UObject::ProcessEvent(UFunction*, void*)  []
        libUE4.so(0x0000000007EEE800)!void TScriptDelegate<FWeakObjectPtr>::ProcessDelegate<UObject>(void*) const  []
        libUE4.so(0x0000000007F1A7D4)!void TMulticastScriptDelegate<FWeakObjectPtr>::ProcessMulticastDelegate<UObject>(void*) const  []
        libUE4.so(0x000000000BE6DF58)!UButton::SlateHandleClicked()  []
        libUE4.so(0x0000000009CCB978)!SButton::ExecuteOnClick()  []
        libUE4.so(0x0000000009CE28A8)!SButton::OnMouseButtonUp(FGeometry const&, FPointerEvent const&)  []
        libUE4.so(0x0000000009B51030)!FSlateApplication::RoutePointerUpEvent(FWidgetPath const&, FPointerEvent const&)  []
        libUE4.so(0x0000000009B15220)!FSlateApplication::ProcessMouseButtonUpEvent(FPointerEvent const&)  []
        libUE4.so(0x0000000009B5B868)!FSlateApplication::OnTouchEnded(FVector2D const&, int, int)  []
        libUE4.so(0x000000000997079C)!FAndroidInputInterface::SendControllerEvents()  []
        libUE4.so(0x000000000996F744)!FAndroidApplication::PollGameDeviceState(float)  []
        libUE4.so(0x0000000007EB24C0)!FEngineLoop::Tick()  []
        libUE4.so(0x0000000007EAA630)!AndroidMain(android_app*)  []
        libUE4.so(0x0000000007EBA0F8)!android_main()  []
        libUE4.so(0x0000000007EE95BC)![Unknown]()  []
        libc.so(0x00000000000EB7A8)![Unknown]()  []
        libc.so(0x000000000008BC8C)![Unknown]()  []

Plugin code for crash/asserts generation.

UE4 assertions reference can be found here.

@bruno-garcia
Copy link
Member Author

Facing this behavior when running the debug build on Android device - even though the app crashes Sentry doesn't capture anything
For some reason SDK acts like this only with asserts while the crashes are logged as expected

@bruno-garcia bruno-garcia moved this to Needs Discussion in Mobile & Cross Platform SDK May 13, 2022
@bruno-garcia bruno-garcia moved this from Needs Discussion to Needs Investigation in Mobile & Cross Platform SDK May 13, 2022
@vtzay
Copy link

vtzay commented Jun 3, 2022

I facing with this on Android and IOS in Development Builds. App has been crashed by fatal log message.

@souredoutlook
Copy link
Member

souredoutlook commented Jun 6, 2022

I facing with this on Android and IOS in Development Builds. App has been crashed by fatal log message.

cc @bruno-garcia adding some additional details to the above report:

Using plugin for Unreal Engine version 4.27
Out tests on Android and IOS: capture info message, capture fatal message, and app crash.
Info and fatal messages were captured by sentry from both platforms. But crashes were not on either.
Plugin settings: set DSN, turn on auto initialize.

@souredoutlook
Copy link
Member

Hey @vtzay can you let us know exaclty how you're crashing? With Asserts or some other way? Could you try:

    char *ptr = 0;
    *ptr += 1;

?

@tustanivsky
Copy link
Collaborator

Hi @souredoutlook, this issue occurs only when using asserts. Here is the sample that is used in the UE plugin demo:

void USentryLibrary::Assert()
{
	char *ptr = nullptr;
	check(ptr != nullptr);
}

The snippet you've shared above crashes the app and the corresponding event captured by Sentry as expected in this case.

P.S. With sentry-java 6.0.0 problem still persists

@vtzay
Copy link

vtzay commented Jun 9, 2022

Hey @vtzay can you let us know exaclty how you're crashing? With Asserts or some other way? Could you try:

    char *ptr = 0;
    *ptr += 1;

?

Yes it's working ok.

We think it's possible to catch and send crashes on fatal logs using SDK calls.
Unreal may call some code on a non-main thread at the time of the crash before it exits.
For example, we can send a log message as Breadcrumb.
We may try to do this and can share if the result is successful.

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

Successfully merging a pull request may close this issue.

5 participants