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

sgen-tarjan-bridge.c crash #9377

Closed
pubudulk opened this issue Oct 8, 2024 · 5 comments
Closed

sgen-tarjan-bridge.c crash #9377

pubudulk opened this issue Oct 8, 2024 · 5 comments
Assignees
Labels
Area: Mono Runtime Mono-related issues: BCL bugs, AOT issues, etc. need-attention A xamarin-android contributor needs to review

Comments

@pubudulk
Copy link

pubudulk commented Oct 8, 2024

Android framework version

net8.0-android

Affected platform version

VS2022

Description

Application getting crashed intermittently (but often) with following error:


10-08 11:40:06.026  1685  7753 W Parcel  : Expecting binder but got null!
10-08 11:40:06.065 23449 23480 W Parcel  : Expecting binder but got null!
10-08 11:40:06.068  1685  4175 D CoreBackPreview: Window{2d24733 u0 com.xxx.xxx/crc64089f5dbede512c6e.SyncMonitor}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@f35f869, mPriority=0}
10-08 11:40:06.078 23449 23449 D SyncMonitorTransaction: OnResume()
10-08 11:40:06.229 23449 23688 E renanative10IBS: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mono/metadata/sgen-tarjan-bridge.c:1172, condition `xref_count == xref_index' not met, function:processing_build_callback_data, xref_count is 7807 but we added 7805 xrefs
10-08 11:40:06.229 23449 23480 E OpenGLRenderer: Unable to match the desired swap behavior.
--------- beginning of crash
10-08 11:40:06.229 23449 23688 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 23688 (Thread Pool Wor), pid 23449 (renanative10IBS)
10-08 11:40:06.358 25496 25496 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
10-08 11:40:06.364   764   764 I tombstoned: received crash request for pid 23688
10-08 11:40:06.365 25496 25496 I crash_dump64: performing dump of process 23449 (target tid = 23688)
10-08 11:40:06.667  1045  1045 W binder:1045_3: type=1400 audit(0.0:939951): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.673  1045  1045 W binder:1045_3: type=1400 audit(0.0:939952): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.680  1045  1045 W binder:1045_3: type=1400 audit(0.0:939953): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.683  1045  1045 W binder:1045_3: type=1400 audit(0.0:939954): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.690  1045  1045 W binder:1045_3: type=1400 audit(0.0:939955): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.693 25496 25496 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-08 11:40:06.693 25496 25496 F DEBUG   : Build fingerprint: 'google/sunfish/sunfish:13/TQ3A.230805.001.S1/10786265:user/release-keys'
10-08 11:40:06.693 25496 25496 F DEBUG   : Revision: 'MP1.0'
10-08 11:40:06.693 25496 25496 F DEBUG   : ABI: 'arm64'
10-08 11:40:06.694 25496 25496 F DEBUG   : Timestamp: 2024-10-08 11:40:06.380467864+0530
10-08 11:40:06.694 25496 25496 F DEBUG   : Process uptime: 464s
10-08 11:40:06.694 25496 25496 F DEBUG   : Cmdline: com.xxx.xxx
10-08 11:40:06.694 25496 25496 F DEBUG   : pid: 23449, tid: 23688, name: Thread Pool Wor  >>> com.xxx.xxx <<<
10-08 11:40:06.694 25496 25496 F DEBUG   : uid: 10454
10-08 11:40:06.694 25496 25496 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
10-08 11:40:06.694 25496 25496 F DEBUG   :     x0  0000000000000000  x1  0000000000005c88  x2  0000000000000006  x3  0000007394e1ffa0
10-08 11:40:06.694 25496 25496 F DEBUG   :     x4  64692e7164636b68  x5  64692e7164636b68  x6  64692e7164636b68  x7  7f7f7f7f7f7f7f7f
10-08 11:40:06.694 25496 25496 F DEBUG   :     x8  00000000000000f0  x9  00000076cb1baa00  x10 0000000000000001  x11 00000076cb1f8de4
10-08 11:40:06.694 25496 25496 F DEBUG   :     x12 0000007394e1edc0  x13 0000000000000101  x14 0000007394e1ee70  x15 0000000000791a80
10-08 11:40:06.694 25496 25496 F DEBUG   :     x16 00000076cb25dd58  x17 00000076cb23ac70  x18 0000000000000014  x19 0000000000005b99
10-08 11:40:06.694 25496 25496 F DEBUG   :     x20 0000000000005c88  x21 00000000ffffffff  x22 0000007413783d40  x23 000000737a9177b0
10-08 11:40:06.694 25496 25496 F DEBUG   :     x24 0000007413787000  x25 0000007413783000  x26 0000000000000000  x27 0000000000000001
10-08 11:40:06.694 25496 25496 F DEBUG   :     x28 0000007413783000  x29 0000007394e20020
10-08 11:40:06.694 25496 25496 F DEBUG   :     lr  00000076cb1ea968  sp  0000007394e1ff80  pc  00000076cb1ea994  pst 0000000000000000
10-08 11:40:06.694 25496 25496 F DEBUG   : backtrace:
10-08 11:40:06.694 25496 25496 F DEBUG   :       #00 pc 0000000000051994  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 4e07915368c859b1910c68c84a8de75f)
10-08 11:40:06.694 25496 25496 F DEBUG   :       #01 pc 000000000001a830  /data/app/~~ABYq3sDy0tP6ivQSiyxlgw==/com.xxx.xxx-ztyNeN9QK_kxt9fMRr5nuQ==/lib/arm64/libmonodroid.so (xamarin::android::Helpers::abort_application()+8) (BuildId: 0feb671112df01a08f7ee98e5a80b43c167c8c90)
10-08 11:40:06.694 25496 25496 F DEBUG   :       #02 pc 0000000000031b04  /data/app/~~ABYq3sDy0tP6ivQSiyxlgw==/com.xxx.xxx-ztyNeN9QK_kxt9fMRr5nuQ==/lib/arm64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::mono_log_handler(char const*, char const*, char const*, int, void*)+144) (BuildId: 0feb671112df01a08f7ee98e5a80b43c167c8c90)
10-08 11:40:06.694 25496 25496 F DEBUG   :       #03 pc 000000000028fb8c  /data/app/~~ABYq3sDy0tP6ivQSiyxlgw==/com.x.xxx-ztyNeN9QK_kxt9fMRr5nuQ==/lib/arm64/libmonosgen-2.0.so (monoeg_g_logv_nofree+192)
10-08 11:40:06.719   764   764 E tombstoned: Tombstone written to: tombstone_08 

This issue was previously reported: mono/mono#9314
But seems to be broken in latest Xamarin.Android versions.

We tried setting the following params but did not work
MONO_GC_PARAMS=bridge-implementation=new,nursery-size=128‌​m,soft-heap-limit=51‌​2m

We set the param like below in Application's onCreate() method.
Java.Lang.JavaSystem.SetProperty("MONO_GC_PARAMS", "bridge-implementation=new,nursery-size=128‌​m,soft-heap-limit=51‌​2m");

Steps to Reproduce

No exact steps to reproduce

Did you find any workaround?

No

Relevant log output

10-08 11:40:06.026  1685  7753 W Parcel  : Expecting binder but got null!
10-08 11:40:06.065 23449 23480 W Parcel  : Expecting binder but got null!
10-08 11:40:06.068  1685  4175 D CoreBackPreview: Window{2d24733 u0 com.xxx.xxx/crc64089f5dbede512c6e.SyncMonitor}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@f35f869, mPriority=0}
10-08 11:40:06.078 23449 23449 D SyncMonitorTransaction: OnResume()
10-08 11:40:06.229 23449 23688 E renanative10IBS: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mono/metadata/sgen-tarjan-bridge.c:1172, condition `xref_count == xref_index' not met, function:processing_build_callback_data, xref_count is 7807 but we added 7805 xrefs
10-08 11:40:06.229 23449 23480 E OpenGLRenderer: Unable to match the desired swap behavior.
--------- beginning of crash
10-08 11:40:06.229 23449 23688 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 23688 (Thread Pool Wor), pid 23449 (renanative10IBS)
10-08 11:40:06.358 25496 25496 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto
10-08 11:40:06.364   764   764 I tombstoned: received crash request for pid 23688
10-08 11:40:06.365 25496 25496 I crash_dump64: performing dump of process 23449 (target tid = 23688)
10-08 11:40:06.667  1045  1045 W binder:1045_3: type=1400 audit(0.0:939951): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.673  1045  1045 W binder:1045_3: type=1400 audit(0.0:939952): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.680  1045  1045 W binder:1045_3: type=1400 audit(0.0:939953): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.683  1045  1045 W binder:1045_3: type=1400 audit(0.0:939954): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.690  1045  1045 W binder:1045_3: type=1400 audit(0.0:939955): avc: denied { write } for name="statsdw" dev="tmpfs" ino=29520 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:statsdw_socket:s0 tclass=sock_file permissive=0
10-08 11:40:06.693 25496 25496 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-08 11:40:06.693 25496 25496 F DEBUG   : Build fingerprint: 'google/sunfish/sunfish:13/TQ3A.230805.001.S1/10786265:user/release-keys'
10-08 11:40:06.693 25496 25496 F DEBUG   : Revision: 'MP1.0'
10-08 11:40:06.693 25496 25496 F DEBUG   : ABI: 'arm64'
10-08 11:40:06.694 25496 25496 F DEBUG   : Timestamp: 2024-10-08 11:40:06.380467864+0530
10-08 11:40:06.694 25496 25496 F DEBUG   : Process uptime: 464s
10-08 11:40:06.694 25496 25496 F DEBUG   : Cmdline: com.xxx.xxx
10-08 11:40:06.694 25496 25496 F DEBUG   : pid: 23449, tid: 23688, name: Thread Pool Wor  >>> com.xxx.xxx <<<
10-08 11:40:06.694 25496 25496 F DEBUG   : uid: 10454
10-08 11:40:06.694 25496 25496 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
10-08 11:40:06.694 25496 25496 F DEBUG   :     x0  0000000000000000  x1  0000000000005c88  x2  0000000000000006  x3  0000007394e1ffa0
10-08 11:40:06.694 25496 25496 F DEBUG   :     x4  64692e7164636b68  x5  64692e7164636b68  x6  64692e7164636b68  x7  7f7f7f7f7f7f7f7f
10-08 11:40:06.694 25496 25496 F DEBUG   :     x8  00000000000000f0  x9  00000076cb1baa00  x10 0000000000000001  x11 00000076cb1f8de4
10-08 11:40:06.694 25496 25496 F DEBUG   :     x12 0000007394e1edc0  x13 0000000000000101  x14 0000007394e1ee70  x15 0000000000791a80
10-08 11:40:06.694 25496 25496 F DEBUG   :     x16 00000076cb25dd58  x17 00000076cb23ac70  x18 0000000000000014  x19 0000000000005b99
10-08 11:40:06.694 25496 25496 F DEBUG   :     x20 0000000000005c88  x21 00000000ffffffff  x22 0000007413783d40  x23 000000737a9177b0
10-08 11:40:06.694 25496 25496 F DEBUG   :     x24 0000007413787000  x25 0000007413783000  x26 0000000000000000  x27 0000000000000001
10-08 11:40:06.694 25496 25496 F DEBUG   :     x28 0000007413783000  x29 0000007394e20020
10-08 11:40:06.694 25496 25496 F DEBUG   :     lr  00000076cb1ea968  sp  0000007394e1ff80  pc  00000076cb1ea994  pst 0000000000000000
10-08 11:40:06.694 25496 25496 F DEBUG   : backtrace:
10-08 11:40:06.694 25496 25496 F DEBUG   :       #00 pc 0000000000051994  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 4e07915368c859b1910c68c84a8de75f)
10-08 11:40:06.694 25496 25496 F DEBUG   :       #01 pc 000000000001a830  /data/app/~~ABYq3sDy0tP6ivQSiyxlgw==/com.xxx.xxx-ztyNeN9QK_kxt9fMRr5nuQ==/lib/arm64/libmonodroid.so (xamarin::android::Helpers::abort_application()+8) (BuildId: 0feb671112df01a08f7ee98e5a80b43c167c8c90)
10-08 11:40:06.694 25496 25496 F DEBUG   :       #02 pc 0000000000031b04  /data/app/~~ABYq3sDy0tP6ivQSiyxlgw==/com.xxx.xxx-ztyNeN9QK_kxt9fMRr5nuQ==/lib/arm64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::mono_log_handler(char const*, char const*, char const*, int, void*)+144) (BuildId: 0feb671112df01a08f7ee98e5a80b43c167c8c90)
10-08 11:40:06.694 25496 25496 F DEBUG   :       #03 pc 000000000028fb8c  /data/app/~~ABYq3sDy0tP6ivQSiyxlgw==/com.x.xxx-ztyNeN9QK_kxt9fMRr5nuQ==/lib/arm64/libmonosgen-2.0.so (monoeg_g_logv_nofree+192)
10-08 11:40:06.719   764   764 E tombstoned: Tombstone written to: tombstone_08
@pubudulk pubudulk added Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned. labels Oct 8, 2024
@grendello grendello added Area: Mono Runtime Mono-related issues: BCL bugs, AOT issues, etc. and removed Area: App Runtime Issues in `libmonodroid.so`. needs-triage Issues that need to be assigned. labels Oct 8, 2024
@grendello
Copy link
Contributor

@pubudulk This crash appears to be generated by Xamarin.Android classic, which is already out of support and will not receive fixes, alas. Can you update your app to net8 (you do not need to use MAUI) and see if the failure happens there as well? Thanks!

@grendello grendello added the need-info Issues that need more information from the author. label Oct 8, 2024
@BrzVlad
Copy link
Member

BrzVlad commented Oct 8, 2024

Note that this is a well known issue that still happens on .NET8. I haven't yet been able to reproduce it, the current workaround is to use new bridge instead. This issue should be closed. Tracked in dotnet/runtime#106410 (comment).

@dotnet-policy-service dotnet-policy-service bot added need-attention A xamarin-android contributor needs to review and removed need-info Issues that need more information from the author. labels Oct 8, 2024
@pubudulk
Copy link
Author

pubudulk commented Oct 8, 2024

Note that this is a well known issue that still happens on .NET8. I haven't yet been able to reproduce it, the current workaround is to use new bridge instead. This issue should be closed. Tracked in dotnet/runtime#106410 (comment).

Are you suggesting to use the Environment.txt file approach rather than code approach mentioned below? We tried setting the bridge implementation like below but it didnt work.
Java.Lang.JavaSystem.SetProperty("MONO_GC_PARAMS", "bridge-implementation=new,nursery-size=128‌​m,soft-heap-limit=51‌​2m");

@grendello
Copy link
Contributor

@pubudulk Environment.txt should be used, yes.

@grendello
Copy link
Contributor

Closing because the issue is already tracked here

@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Mono Runtime Mono-related issues: BCL bugs, AOT issues, etc. need-attention A xamarin-android contributor needs to review
Projects
None yet
Development

No branches or pull requests

3 participants