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

Linux desktop support - crashpad #733

Closed
wants to merge 10 commits into from
Closed

Linux desktop support - crashpad #733

wants to merge 10 commits into from

Conversation

vaind
Copy link
Collaborator

@vaind vaind commented May 8, 2022

Edit: crashpad won't work, see below in comments


closes #694, replaces #699

TODOs

  • symbol upload
  • integration test

@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2022

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Linux desktop support - crashpad ([#733](https://github.com/getsentry/sentry-unity/pull/733))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against e32b245

@vaind vaind mentioned this pull request May 9, 2022
2 tasks
@vaind vaind changed the title Linux desktop support Linux desktop support - crashpad May 9, 2022
@vaind
Copy link
Collaborator Author

vaind commented May 9, 2022

Crashpad integration doesn't seem to work properly - after starting the game, it gets stuck with high CPU usage and no scene loaded. The game can only be killed with 9 - SIGKILL - doesn't respond to standard close or sigterm

image

image

Default vsync count 1
requesting resize 1024 x 768
resizing window to 1024 x 768
Desktop is 3840 x 2160 @ 60 Hz
UnloadTime: 0.351288 ms
Sentry: (Debug) Logging enabled with 'UnityLogger' min level: Debug
SmokeTester.Configure() called but skipped because this is not a SmokeTest (no arg)
Sentry: (Debug) Setting Release: [email protected]
Sentry: (Debug) Setting Environment: production
Sentry: (Debug) Setting Debug: True
Sentry: (Debug) Disabling native auto session tracking
Sentry: (Debug) Setting CacheDirectoryPath: /home/ivan/.config/unity3d/DefaultCompany/unity-of-bugs/SentryNative
Sentry: (Debug) Setting a native logger
Sentry: (Debug) Initializing sentry native
Sentry: (Info) Native: using database path "/home/ivan/.config/unity3d/DefaultCompany/unity-of-bugs/SentryNative"
Sentry: (Debug) Native: starting transport
Sentry: (Debug) Native: starting background worker thread
Sentry: (Debug) Native: starting backend
Sentry: (Debug) Native: background worker thread started
Sentry: (Debug) Native: starting crashpad backend with handler "/mnt/c/dev/sentry-unity/temp/linux/crashpad_handler"
Sentry: (Debug) Native: using minidump url "https://o447951.ingest.sentry.io:443/api/5439417/minidump/?sentry_client=sentry.native/0.4.17&sentry_key=94677106febe46b88b9b9ae5efd18a00"
Sentry: (Info) Native: started crashpad client handler
Sentry: (Debug) Native: processing and pruning old runs
Sentry: (Debug) Native SDK reported: 'crashedLastRun': 'False'
Sentry: (Debug) Native: starting crashpad backend with handler "/mnt/c/dev/sentry-unity/temp/linux/crashpad_handler"
Sentry: (Debug) Native: using minidump url "https://o447951.ingest.sentry.io:443/api/5439417/minidump/?sentry_client=sentry.native/0.4.17&sentry_key=94677106febe46b88b9b9ae5efd18a00"
Sentry: (Info) Native: started crashpad client handler

another run, with htop

image

yet another run, htop, show thread names

image

@vaind
Copy link
Collaborator Author

vaind commented May 9, 2022

So, it turns out Crashpad cannot be used because it forks the process on Linux and that's not working well with Unity.
I've tried by investigating the sentry-native source and commenting out/adding return false at some appropriate places. The good thing is I can recompile the library and swap it in the compiled game folder at app_Data/Plugins/libsentry.so

  1. CrashpadClient::StartHandler() calls DoubleForkAndExec(). If I return false (i.e. say the current function failed) before the fork() call inside DoubleForkAndExec(), everything works fine (of course no native crash handling). If I do it right after fork(), the UI stops rendering, turns out as a black screen, while you can still click around and in the log I can see the button actions (send dotnet errors) are still triggered) - but no UI, see the image above: Linux desktop support - crashpad #733 (comment)

  2. Additionally, there seems to be another error, related to log forwarding from native to c# in SentryNativeBridge.cs, I assume it has something to do with the fork() as well because it only has issues after the call.

Therefore, I'm dropping this approach and we're going to breakpad, see #734

@vaind vaind closed this May 9, 2022
@vaind vaind deleted the feat/linux-desktop branch May 10, 2022 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native crash support for Linux
2 participants