maui icon indicating copy to clipboard operation
maui copied to clipboard

Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 25847 (.NET TP Worker) - Bridge SCC at index must NOT be alive

Open yma44 opened this issue 1 year ago • 7 comments

Description

Since we updated our app from Xamarin android to .NET MAUI android, we started to have a crash Bridge SCC at index must NOT be alive coming from: xamarin-android/src/monodroid/jni/osbridge.cc:963 (gc_cleanup_after_java_collection) when our app opens a third party scanning camera, Scandit.

Looks like this happens when the camera opens and our app goes in background and garbage collection runs. Always this GC log can be seen before the crash. zygote64: Explicit concurrent copying GC freed 44801(2MB) AllocSpace objects, 53(9MB) LOS objects, 58% free, 8MB/20MB, paused 96us total 41.578ms

We have reported this to Scandit, but I wonder whether we can get some input from you.

--------- beginning of crash 05-31 11:20:04.693 10530 23317 25847 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 25847 (.NET TP Worker), pid 23317 (.myapp.scan) 05-31 11:20:04.945 10530 26525 26525 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 05-31 11:20:04.945 10530 26525 26525 F DEBUG : Build fingerprint: 'samsung/j5y17ltexx/j5y17lte:9/PPR1.180610.011/J530FXWS8CUE1:user/release-keys' 05-31 11:20:04.945 10530 26525 26525 F DEBUG : Revision: '7' 05-31 11:20:04.945 10530 26525 26525 F DEBUG : ABI: 'arm' 05-31 11:20:04.945 10530 26525 26525 F DEBUG : pid: 23317, tid: 25847, name: .NET TP Worker >>> com.myapp.scan <<< 05-31 11:20:04.945 10530 26525 26525 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 05-31 11:20:04.945 10530 26525 26525 F DEBUG : Abort message: '/Users/runner/work/1/s/xamarin-android/src/monodroid/jni/osbridge.cc:963 (gc_cleanup_after_java_collection): Bridge SCC at index 106 must NOT be alive' 05-31 11:20:04.945 10530 26525 26525 F DEBUG : r0 00000000 r1 000064f7 r2 00000006 r3 00000008 05-31 11:20:04.945 10530 26525 26525 F DEBUG : r4 00005b15 r5 000064f7 r6 c46fdc14 r7 0000010c 05-31 11:20:04.945 10530 26525 26525 F DEBUG : r8 e36049a0 r9 00000002 r10 eba45004 r11 0000006a 05-31 11:20:04.945 10530 26525 26525 F DEBUG : ip 00000041 sp c46fdc00 lr ebbaa04d pc ebba0f4a 05-31 11:20:04.960 10530 26525 26525 F DEBUG : 05-31 11:20:04.960 10530 26525 26525 F DEBUG : backtrace: 05-31 11:20:04.960 10530 26525 26525 F DEBUG : #00 pc 0001cf4a /system/lib/libc.so (abort+58) 05-31 11:20:04.960 10530 26525 26525 F DEBUG : #01 pc 00015fbd /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (xamarin::android::Helpers::abort_application()+4) 05-31 11:20:04.960 10530 26525 26525 F DEBUG : #02 pc 000241bd /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (do_abort_unless(char const*, ...)+36) 05-31 11:20:04.960 10530 26525 26525 F DEBUG : #03 pc 00024697 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (xamarin::android::internal::OSBridge::gc_cleanup_after_java_collection(_JNIEnv*, int, MonoGCBridgeSCC**)+386) 05-31 11:20:04.960 10530 26525 26525 F DEBUG : #04 pc 00022e9b /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (xamarin::android::internal::OSBridge::gc_cross_references(int, MonoGCBridgeSCC**, int, MonoGCBridgeXRef*)+162) 05-31 11:20:04.960 10530 26525 26525 F DEBUG : #05 pc 00022deb /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (gc_cross_references_cb+22) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #06 pc 001e1785 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #07 pc 001ff62b /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #08 pc 001fd017 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #09 pc 001fcc6d /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #10 pc 001fa88f /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #11 pc 001e85cf /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:20:04.961 10530 26525 26525 F DEBUG : #12 pc 00002c86 anonymous:ec4f9000 05-31 11:21:36.827 10530 26770 27067 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 27067 (pool-8-thread-1), pid 26770 (.myapp.scan) 05-31 11:21:37.099 10530 27088 27088 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 05-31 11:21:37.099 10530 27088 27088 F DEBUG : Build fingerprint: 'samsung/j5y17ltexx/j5y17lte:9/PPR1.180610.011/J530FXWS8CUE1:user/release-keys' 05-31 11:21:37.099 10530 27088 27088 F DEBUG : Revision: '7' 05-31 11:21:37.099 10530 27088 27088 F DEBUG : ABI: 'arm' 05-31 11:21:37.099 10530 27088 27088 F DEBUG : pid: 26770, tid: 27067, name: pool-8-thread-1 >>> com.myapp.scan <<< 05-31 11:21:37.099 10530 27088 27088 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 05-31 11:21:37.099 10530 27088 27088 F DEBUG : Abort message: '/Users/runner/work/1/s/xamarin-android/src/monodroid/jni/osbridge.cc:963 (gc_cleanup_after_java_collection): Bridge SCC at index 392 must NOT be alive' 05-31 11:21:37.099 10530 27088 27088 F DEBUG : r0 00000000 r1 000069bb r2 00000006 r3 00000008 05-31 11:21:37.099 10530 27088 27088 F DEBUG : r4 00006892 r5 000069bb r6 b0e1cb9c r7 0000010c 05-31 11:21:37.099 10530 27088 27088 F DEBUG : r8 bafa0760 r9 00000002 r10 e75baaac r11 00000188 05-31 11:21:37.099 10530 27088 27088 F DEBUG : ip 00000041 sp b0e1cb88 lr ebbaa04d pc ebba0f4a 05-31 11:21:37.120 10530 27088 27088 F DEBUG : 05-31 11:21:37.120 10530 27088 27088 F DEBUG : backtrace: 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #00 pc 0001cf4a /system/lib/libc.so (abort+58) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #01 pc 00015fbd /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (xamarin::android::Helpers::abort_application()+4) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #02 pc 000241bd /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (do_abort_unless(char const*, ...)+36) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #03 pc 00024697 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (xamarin::android::internal::OSBridge::gc_cleanup_after_java_collection(_JNIEnv*, int, MonoGCBridgeSCC**)+386) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #04 pc 00022e9b /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (xamarin::android::internal::OSBridge::gc_cross_references(int, MonoGCBridgeSCC**, int, MonoGCBridgeXRef*)+162) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #05 pc 00022deb /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x1178000) (gc_cross_references_cb+22) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #06 pc 001e1785 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #07 pc 001ff62b /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:21:37.120 10530 27088 27088 F DEBUG : #08 pc 001fd017 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:21:37.121 10530 27088 27088 F DEBUG : #09 pc 001fdb39 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) 05-31 11:21:37.121 10530 27088 27088 F DEBUG : #10 pc 001e9d53 /data/app/com.myapp.scan-FvexpgjAk7BaMBvH3AzJYw==/split_config.armeabi_v7a.apk (offset 0x11b8000) (mono_gc_collect+30) 05-31 11:21:37.121 10530 27088 27088 F DEBUG : #11 pc 0001dcb6 anonymous:e5b6e000

Visual Studio Info Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50 Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

VSPackage Extension 1.0 VSPackage Visual Studio Extension Detailed Info

Xamarin 17.8.0.155 (d17-8@7042beb) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.8.3.6 (remotes/origin/d17-8@eccf46a291) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.8.16 (830b56a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14) Xamarin.Android Reference Assemblies and MSBuild support. Mono: d9a6e87 Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Steps to Reproduce

this is snippets of code for Scandit Camera Activity in our app. Once this activity opens, the app crashes if GC runs after the scan camera opened.

`       
        private DataCaptureContext _dataCaptureContext;
        private DataCaptureView _captureView;
        private BarcodeCapture _capture;
        private Camera _camera;
        private BarcodeCaptureOverlay _overlay;
        private SaveableScanditOverlayView _overlayView;
        private BarcodeCaptureSettings _settings; 

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
            var key = Intent.GetStringExtra(LICENSE_KEY);
            _dataCaptureContext = DataCaptureContext.Builder(key).DeviceName(DeviceSerialNumber).Build();

            _dataCaptureContext.AddListener(this);
            _camera = Camera.GetDefaultCamera(BarcodeCapture.RecommendedCameraSettings);
            if (_camera != null)
            {
                _dataCaptureContext.SetFrameSourceAsync(_camera);
            }
            _settings = BarcodeCaptureSettings.Create();
            var captureDuplicate = Intent.GetBooleanExtra(CAPTURE_DUPLICATE, false);
            _capture = BarcodeCapture.Create(_dataCaptureContext, _settings);

            // set vibrate mode
            var vibrateModeEnabled = Intent.GetBooleanExtra(VIBRATE_ENABLED_KEY, false);
            _capture.Feedback.Success = vibrateModeEnabled ? new Feedback(Vibration.DefaultVibration, null) : new Feedback(null, null);
            _capture.AddListener(this);
            _captureView = DataCaptureView.Create(this, _dataCaptureContext);

            _captureView.AddControl(new TorchSwitchControl());

            _overlay = BarcodeCaptureOverlay.Create(_capture, _captureView);

            // Set laser mode
            _overlay.Viewfinder = new LaserlineViewfinder(LaserlineViewfinderStyle.Legacy);
            _overlayView = new SaveableScanditOverlayView(this);
            _overlayView.SaveButttonClicked += (a, s) =>
            {
                ReturnBarcodes(false);
            };
            SetContentView(_captureView);
        }

        protected override void OnResume()
        {
            base.OnResume();
            _capture.Enabled = true;
            _camera.SwitchToDesiredStateAsync(FrameSourceState.On);
        }
`

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 14, 13, 12,11,10 and 9.

Did you find any workaround?

Not a workaround but this does not happen with our Xamarin app.

Relevant log output

No response

yma44 avatar Jun 03 '24 22:06 yma44

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar Jun 03 '24 22:06 github-actions[bot]

Can you attach a logcat file with your crash? https://learn.microsoft.com/en-us/xamarin/android/deploy-test/debugging/android-debug-log?tabs=windows

PureWeen avatar Jun 04 '24 16:06 PureWeen

Hi @PureWeen, please see the attached log. Thank you bugreport-2024-05-31-12-33-10_github1.zip

yma44 avatar Jun 04 '24 20:06 yma44

new log: bugreport-2024-06-13-09-19-40github2.zip

this has a slightly different backtgrace. We have updated to the new third party library which is targeting .NET 8 (previous one was targeting .NET 6 but compatible with .NET 8). 06-13 09:20:21.259 10538 16176 16176 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-13 09:20:21.259 10538 16176 16176 F DEBUG : Build fingerprint: 'samsung/j5y17ltexx/j5y17lte:9/PPR1.180610.011/J530FXWS8CUE1:user/release-keys' 06-13 09:20:21.259 10538 16176 16176 F DEBUG : Revision: '7' 06-13 09:20:21.260 10538 16176 16176 F DEBUG : ABI: 'arm' 06-13 09:20:21.260 10538 16176 16176 F DEBUG : pid: 14690, tid: 15716, name: .NET TP Worker >>> com.myapp.scan <<< 06-13 09:20:21.260 10538 16176 16176 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 06-13 09:20:21.260 10538 16176 16176 F DEBUG : Abort message: '/Users/runner/work/1/s/xamarin-android/src/monodroid/jni/osbridge.cc:963 (gc_cleanup_after_java_collection): Bridge SCC at index 29 must NOT be alive' 06-13 09:20:21.260 10538 16176 16176 F DEBUG : r0 00000000 r1 00003d64 r2 00000006 r3 00000008 06-13 09:20:21.260 10538 16176 16176 F DEBUG : r4 00003962 r5 00003d64 r6 c02fdf2c r7 0000010c 06-13 09:20:21.260 10538 16176 16176 F DEBUG : r8 c1c22b40 r9 00000002 r10 ec830004 r11 0000001d 06-13 09:20:21.260 10538 16176 16176 F DEBUG : ip 00000041 sp c02fdf18 lr ed4e804d pc ed4def4a 06-13 09:20:21.274 10538 16176 16176 F DEBUG : 06-13 09:20:21.274 10538 16176 16176 F DEBUG : backtrace: 06-13 09:20:21.274 10538 16176 16176 F DEBUG : #00 pc 0001cf4a /system/lib/libc.so (abort+58) 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #01 pc 00015fbd /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonodroid.so (xamarin::android::Helpers::abort_application()+4) 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #02 pc 000241bd /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonodroid.so (do_abort_unless(char const*, ...)+36) 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #03 pc 00024697 /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonodroid.so (xamarin::android::internal::OSBridge::gc_cleanup_after_java_collection(_JNIEnv*, int, MonoGCBridgeSCC**)+386) 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #04 pc 00022e9b /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonodroid.so (xamarin::android::internal::OSBridge::gc_cross_references(int, MonoGCBridgeSCC**, int, MonoGCBridgeXRef*)+162) 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #05 pc 00022deb /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonodroid.so (gc_cross_references_cb+22) 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #06 pc 001e1785 /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonosgen-2.0.so 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #07 pc 001ff62b /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonosgen-2.0.so 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #08 pc 001fd017 /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonosgen-2.0.so 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #09 pc 001fcc6d /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonosgen-2.0.so 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #10 pc 001fa85d /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonosgen-2.0.so 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #11 pc 001e85cf /data/app/com.myapp.scan-8gXJo2rjJpPya6RU0TCR2w==/lib/arm/libmonosgen-2.0.so 06-13 09:20:21.275 10538 16176 16176 F DEBUG : #12 pc 00002cf6 anonymous:ed21b000

We cannot have this issue on all devices, it seems to be happening lower spec phones and when the app's memory becomes high.

yma44 avatar Jun 17 '24 01:06 yma44

@jonathanpeppers anything stand out to you?

PureWeen avatar Jun 28 '24 15:06 PureWeen

Can you share a sample app? It's hard to know what is happening here without know what SaveableScanditOverlayView (or various other types) do.

jonathanpeppers avatar Jun 28 '24 15:06 jonathanpeppers

Thank you @jonathanpeppers,
After you mentioned the class SaveableScanditOerlayView, I reviewed our code again, and realised we were disposing all views created in the activity when the activity finished but NOT SaveableScanditOverlayView object. Once we added the code of cleaning the object (removing eventhandler and calling Dispose() on the view) the crash stopped occurring. It seems to fix the issue, so thank you for giving us a hint!

However the issue did not occur with the same code when we were using Xamarin. We noticed if we call Dispose method manually (other than relying on GC) for any Java objects memory performance is good on Xamarin Architecture.
We cannot provide a sample app but I have attached the class file. SavableScanditOverlayView class is a simple view with a couple of TextPaint and Rect. I wonder whether you can spot anything how not disposing the object caused the issue. Uploading SaveableScanditOverlayView.cs…

yma44 avatar Jul 03 '24 09:07 yma44

Generally, the behavior for Java objects didn't change between Xamarin and .NET 6+. So, if you could share a sample that just has a camera control, we could share more insight on this. Thanks!

jonathanpeppers avatar Jul 03 '24 14:07 jonathanpeppers

Hi @yma44. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.