getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
204 stars 51 forks source link

System.DllNotFoundException runtime.initialization on Unity Headless Linux Server build #1730

Closed AvinashP closed 1 month ago

AvinashP commented 1 month ago

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

  1. Make a Linux Head less server build
  2. Run the build in batch mode
  3. Check the exception
  4. 100% reproduction

Expected Result

There should not be any exception

Actual Result

Unable to load DLL 'sentry'. Tried the load the following dynamic libraries: Unable to load dynamic library 'sentry' because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = sentry: cannot open shared object file: No such file or directory

https://lila-games.sentry.io/issues/5309961659/?alert_rule_id=15175631&alert_type=issue&notification_uuid=9280795c-2fed-49a1-b188-26887e77dee4&project=4507208985804800&referrer=slack

Product Area

Unknown

Link

https://lila-games.sentry.io/issues/5309961659/?alert_rule_id=15175631&alert_type=issue&notification_uuid=9280795c-2fed-49a1-b188-26887e77dee4&project=4507208985804800&referrer=slack

DSN

No response

Version

2.0.7

getsantry[bot] commented 1 month ago

Assigning to @getsentry/support for routing ⏲️

bitsandfoxes commented 1 month ago

Hey @AvinashP, thanks for raising this! We'll look into it!

tustanivsky commented 1 month ago

Quick update regarding this issue:

Apparently, this behavior is specific to older Linux versions. Unity headless Linux server build works as expected on Ubuntu 22.04 but it throws the exception on startup as described above on Ubuntu 20.04 After enabling Load on startup option for libsentry.so that we provide along with other package binaries I've managed to get the following message in logs when attempting to run the build:

.../Plugins/libsentry.so, error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found

It looks that there is a discrepancy between libs required to build libsentry.so in our CI and those that are available locally on the test machine. The CI build is running on ubuntu-latest (22.04) which yields the following GLIBC symbol dependencies for libsentry.so:

$ objdump -T libsentry.so | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vur
2.34
2.33
2.17
2.15
2.14
2.7
2.4
2.3.4
2.3.2
2.3
2.2.5

While on Ubuntu 20.04 we have:

$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vur
2.26
2.25
2.18
2.17
2.16
2.14
2.7
2.6
2.4
2.3.4
2.3.2
2.3
2.2.5

The potential workaround for this issue could be either updating to a newer Linux version to run server builds or installing missing dependencies on an older one.

@bitsandfoxes Alternatively, we can consider switching to ubuntu-20.04 GitHub runner to build sentry-native for Linux in CI.