Closed divil5000 closed 3 months ago
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos See info in area-owners.md if you want to be subscribed.
Author: | divil5000 |
---|---|
Assignees: | - |
Labels: | `untriaged`, `os-ios`, `needs-area-label` |
Milestone: | - |
This seems to be a crash in GlobalizationNative_InitICUFunctions
, possibly due to missing ICU files in the application bundle.
Today is the first time I've read about ICU files. I am unaware of ever having needed to include any with our app on any platform, certainly. What (in the code) would trigger the need for an ICU file?
Any string functions that deal with globalization require the ICU libraries and data files. They are normally bundled as part of the net7.0-ios app bundle when building the app but it seems that it may have failed for your app somewhere in the process.
It's hard to imagine, given that our app works perfectly without the use of this library, and this function we are calling only really does number-crunching. Is it possible that an exception is about to be thrown, and .net is trying to use ICU libraries to format the exception message or similar?
Edit to say: the function we are calling almost certainly does not concern itself with strings!
Hm not really since it's trying to initialize ICU which probably should've already happened at that point, unless you're not doing culture-sensitive string operations (but the library might).
Can you please try running on net8.0-ios to see if it reproduces there?
Tagging subscribers to this area: @dotnet/area-system-globalization See info in area-owners.md if you want to be subscribed.
Author: | divil5000 |
---|---|
Assignees: | - |
Labels: | `area-System.Globalization`, `untriaged`, `os-ios`, `needs-area-label` |
Milestone: | - |
Confirmed reproduced on net8.0-ios. The native crash output is different, though.
537DBDB71C0/appname6.app/appname6 :
0x1072a1c70 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c89b34 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c819a0 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c92c5c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c92ee0 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c9bf7c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105cb6a24 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1061169a8 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106128
:
0x105cb6a24 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1061169a8 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106128c50 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1061272d8 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106120874 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1062375ac - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106239530 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106236b3c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10719f6b0 - /private/var/containers/Bundl
e/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1073ee758 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1077faca0 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x1077a2364 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x1077b763c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x2296df6b8 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
0x2296deb88 - /usr/lib/system/libsystem_pthread.dylib : thread_start
=================================================================
Basic Fault Address Reporting
=================================================================
instruction pointer is NULL, skip dumping
=======================
undle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x1077f7a20 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x229649214 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x10728db74 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10728d16c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10728cf84 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10728c798 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x107018954 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1072a1d2c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C
==========================================
Managed Stacktrace:
=================================================================
=================================================================
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
An error has occurred in the native fault reporting. Some diagnostic information will be unavailable.
=================================================================
Native stacktrace:
=================================================================
0x10782a7ac - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x107815698 - /private/var/containers/B
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Native stacktrace:
8-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x107018954 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1072a1d2c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1072a1c70 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c89b34 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c819a0 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c92c5c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c92ee0 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x105c9bf7c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6
=================================================================
0x10782a7ac - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x107815698 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x1077f7a20 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x229649214 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x10728db74 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10728d16c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10728cf84 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10728c798 - /private/var/containers/Bundle/Application/5AF5D644-9C3
c50 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1061272d8 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106120874 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1062375ac - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106239530 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x106236b3c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x10719f6b0 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1073ee758 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 :
0x1077faca0 - /private/var/containers/Bundle/Application
/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x1077a2364 - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x1077b763c - /private/var/containers/Bundle/Application/5AF5D644-9C38-4125-8040-C537DBDB71C0/appname6.app/appname6 : AppleCryptoNative_DigestReset
0x2296df6b8 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
0x2296deb88 - /usr/lib/system/libsystem_pthread.dylib : thread_start
Exiting early due to double fault.
The app has been terminated.
I am not actually so sure that this output is helpful. I doubt very much that in the first output it's actually a string function that is the problem, as string functions are not being used. I doubt also that anything to do with encryption is being used, as the second output suggests. It seems the runtime is being thrown completely though.
I tried reproducing it with the latest main on a desktop running fullAOT-llvm (the configuration used for ios deployment) but wasn't able to reproduce it with the following code:
using System;
using Clipper2Lib;
var paths = new PathsD();
var polygon = new PathD();
polygon.AddRange(new PointD[]
{ new PointD(-8470.4501953125, -42813.28125), new PointD(-8460.7470703125, -42814.30078125), new PointD(-8440.5146484375, -42820.4609375), new PointD(-8420.0205078125, -42825.6875), new PointD(-8399.310546875, -42829.984375), new PointD(-8378.4248046875, -42833.3359375), new PointD(-8357.4091796875, -42835.73046875), new PointD(-8336.3046875, -42837.17578125), new PointD(-8315.15625, -42837.65234375), new PointD(-8294.0087890625, -42837.17578125), new PointD(-8272.904296875, -42835.73046875), new PointD(-8251.8876953125, -42833.3359375), new PointD(-8231.001953125, -42829.984375), new PointD(-8210.2919921875, -42825.6875), new PointD(-8189.798828125, -42820.4609375), new PointD(-8169.56591796875, -42814.30078125), new PointD(-8149.63525390625, -42807.234375), new PointD(-8130.0478515625, -42799.26953125), new PointD(-8110.84375, -42790.42578125), new PointD(-8092.0634765625, -42780.71484375), new PointD(-8073.74462890625, -42770.1640625), new PointD(-8055.92626953125, -42758.80078125), new PointD(-8038.64501953125, -42746.63671875), new PointD(-8021.93505859375, -42733.69921875), new PointD(-8005.83203125, -42720.02734375), new PointD(-7990.3681640625, -42705.63671875), new PointD(-7975.576171875, -42690.55859375), new PointD(-7961.4853515625, -42674.8359375), new PointD(-7948.12451171875, -42658.48828125), new PointD(-7935.52099609375, -42641.5546875), new PointD(-7923.7001953125, -42624.0703125), new PointD(-7912.68603515625, -42606.078125), new PointD(-7902.5, -42587.6015625), new PointD(-7893.16357421875, -42568.69140625), new PointD(-7884.6953125, -42549.3828125), new PointD(-7877.11181640625, -42529.70703125), new PointD(-7870.42822265625, -42509.71875), new PointD(-7864.65673828125, -42489.45703125), new PointD(-7859.8095703125, -42468.94921875), new PointD(-7855.8955078125, -42448.2578125), new PointD(-7852.92236328125, -42427.41015625), new PointD(-7850.8955078125, -42406.453125), new PointD(-7849.81884765625, -42385.43359375), new PointD(-7849.0029296875, -42371.94921875), new PointD(-7849.0029296875, -42012.6640625), new PointD(-7849.0029296875, -41318.671875), new PointD(-8224.318359375, -40734.03125), new PointD(-8492.20703125, -40526.49609375), new PointD(-8609.970703125, -40434.828125), new PointD(-8811.7705078125, -40277.3125), new PointD(-9790.8564453125, -40277.3125), new PointD(-9026.5986328125,
-40790.921875), new PointD(-9027.2783203125, -40791.44140625), new PointD(-9029.970703125, -40792.84765625), new PointD(-9027.005859375, -40794.21875), new PointD(-9027.822265625, -40795.77734375), new PointD(-9026.9111328125, -40796.8046875), new PointD(-9028.0400390625, -40796.8359375), new PointD(-9024.7216796875, -40798.8203125), new PointD(-9025.673828125, -40802.96875), new PointD(-9022.1513671875, -40804.66796875), new PointD(-9025.197265625, -40807.984375), new PointD(-9025.224609375, -40809.875), new PointD(-9017.21484375, -40822.0625), new PointD(-9017.9501953125, -40826.51953125), new PointD(-9014.9580078125, -40830.203125), new PointD(-9013.326171875, -40836.69921875), new PointD(-9009.1923828125, -40838.5390625), new PointD(-9009.369140625, -40841.125), new PointD(-9006.486328125, -40842.79296875), new PointD(-9006.5673828125, -40846.52734375), new PointD(-9001.658203125, -40853.26171875), new PointD(-9047.294921875, -41015.08984375), new PointD(-9048.568359375, -41014.8203125), new PointD(-9066.6923828125, -41005.09765625), new PointD(-9085.611328125, -40997.03125), new PointD(-9105.1748046875, -40990.69140625), new PointD(-9125.2265625, -40986.125), new PointD(-9145.6025390625, -40983.375), new PointD(-9166.14453125, -40982.453125), new PointD(-9186.6865234375, -40983.375), new PointD(-9207.0634765625, -40986.125), new PointD(-9227.1142578125, -40990.69140625), new PointD(-9246.677734375, -40997.03125), new PointD(-9265.59765625, -41005.09765625), new PointD(-9283.7216796875, -41014.8203125),
new PointD(-9300.9052734375, -41026.125), new PointD(-9317.009765625, -41038.9296875), new PointD(-9331.9091796875, -41053.12109375), new PointD(-9345.478515625, -41068.59375), new PointD(-9357.611328125, -41085.22265625), new PointD(-9368.2099609375, -41102.87109375), new PointD(-9377.1875, -41121.40234375), new PointD(-9384.470703125, -41140.671875), new PointD(-9390, -41160.51171875), new PointD(-9393.73046875, -41180.78125), new PointD(-9395.6298828125, -41201.30078125), new PointD(-9395.6826171875, -41221.91796875), new PointD(-9393.88671875, -41242.45703125), new PointD(-9390.255859375, -41262.76171875), new PointD(-9388.34375, -41269.80859375), new PointD(-9254.806640625, -41225.50390625), new PointD(-9246.5263671875, -41223.62109375), new PointD(-9230.2265625, -41220.1015625), new PointD(-9213.6455078125, -41218.3359375), new PointD(-9196.970703125, -41218.3359375), new PointD(-9180.3896484375, -41220.1015625), new PointD(-9164.08984375, -41223.62109375), new PointD(-9148.2548828125, -41228.8515625), new PointD(-9133.0615234375, -41235.73046875), new PointD(-9118.6845703125, -41244.1875), new PointD(-9105.2841796875, -41254.12109375), new PointD(-9093.8017578125, -41264.2265625), new PointD(-9093.013671875, -41265.421875), new PointD(-9082.009765625, -41277.9609375), new PointD(-9072.3984375, -41291.60546875), new PointD(-9064.2890625, -41306.1953125), new PointD(-9061.708984375, -41311.69140625), new PointD(-8998.6123046875, -41463.6875), new PointD(-8992.357421875, -41478.72265625), new PointD(-8900.16015625, -41700.05078125), new PointD(-8731.5400390625, -41968.6875), new PointD(-8534.0908203125, -42289.3125), new PointD(-8437.814453125, -42444.76171875), new PointD(-8470.4501953125, -42813.28125) });
paths.Add(polygon);
var solutionPolygons = Clipper2Lib.Clipper.InflatePaths(paths, 0.5, Clipper2Lib.JoinType.Round, Clipper2Lib.EndType.Polygon);
using Clipper2 1.3.0 (dotnet add package Clipper2 --version 1.3.0
). As soon as I have an iOS device available, I will try reproducing it with net8.0-ios.
Is anyone actually going to test this? I've given a working reproduction here, and I can supply a simpler one if necessary. I do not believe it's anything to do with Globalization (that is a red herring) rather, this puts the runtime into an unstable state where virtually anything (perhaps on another thread) can appear to be the problem.
Is anyone actually going to test this? I've given a working reproduction here, and I can supply a simpler one if necessary. I do not believe it's anything to do with Globalization (that is a red herring) rather, this puts the runtime into an unstable state where virtually anything (perhaps on another thread) can appear to be the problem.
I am planning to look into it. Sorry for the delay.
I was able to reproduce it locally but so far I didn't find the root cause. I agree that it doesn't look to be connected with Globalization. Please, feel free to share a simpler repro if you have it, that could help us speed the investigation.
It isn't a blocking issue for us any more because I found a workaround:
https://github.com/AngusJohnson/Clipper2/issues/773#issuecomment-1966409912
If you've got the Clipper2 source, you'll see a HorzSegSorter struct, which is a struct whose only purpose is to have a method that performs a sort. It's a weird thing to do, but it seems to be that which is causing mayhem in the runtime. You'll see on that issue that I simply removed the type and made the sort method an instance method of the type that was calling it anyway. It does seem like quite the stability issue though.
Can you confirm it reproduces for you and so does the fix?
It isn't a blocking issue for us any more because I found a workaround:
AngusJohnson/Clipper2#773 (comment)
If you've got the Clipper2 source, you'll see a HorzSegSorter struct, which is a struct whose only purpose is to have a method that performs a sort. It's a weird thing to do, but it seems to be that which is causing mayhem in the runtime. You'll see on that issue that I simply removed the type and made the sort method an instance method of the type that was calling it anyway. It does seem like quite the stability issue though.
Can you confirm it reproduces for you and so does the fix?
Update: I can confirm that the error comes from the ConvertHorzSegsToJoins
based on the obtained log
================================================================
0x1150041a0 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x114fb41c0 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x114f1b778 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
0x1132cf7e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x1095ab174 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Collections_Generic_ArraySortHelper_1_T_REF_InsertionSort_System_Span_1_T_REF_Syste
m_Comparison_1_T_REF (110.1s)
0x1095aa76c - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Collections_Generic_ArraySortHelper_1_T_REF_IntroSort_System_Span_1_T_REF_int_System_Comparison_1_T_REF
0x1095aa584 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Collections_Generic_ArraySortHelper_1_T_REF_IntrospectiveSort_System_Span_1_T_REF_System_Comparison_1_T_REF
0x1095a9d98 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Collections_Generic_ArraySortHelper_1_T_REF_Sort_System_Span_1_T_REF_System_Collections_Generic_IComparer_1_T_REF
0x108f672d4 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Array_Sort_T_REF_T_REF___int_int_System_Collections_Generic_IComparer_1_T_REF
0x1095c5ecc - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Collections_Generic_List_1_T_REF_Sort_int_int_System_Collections_Generic_IComparer_1_T_REF
0x1095c5e10 - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : System_Collections_Generic_List_1_T_REF_Sort_System_Collections_Generic_IComparer_1_T_REF
0x106bc4b5c - /Users//Library/Developer/CoreSimulator/Devices/ADAE97FF-17E3-44F1-B701-55400C16D92B/data/Containers/Bundle/Application/2521F88B-3344-4CDF-8B10-5EB2749844B5/clipper2_crash.app/clipper2_crash : Clipper2Lib_ClipperBase_ConvertHorzSegsToJoins
I don't have a locally build version of Clipper2 so I wasn't able to confirm your fix but it seems that the library already implemented your fix as well (https://github.com/AngusJohnson/Clipper2/commit/f7c126460ea45d4541961c01a4db6f64c9008384).
Good news is that it seems that with .NET 9 preview version the sample no longer crashes. Bad news is that I was not able to reproduce it inside dotnet/runtime using the iOS sample app (i.e., without sdk), so at the moment I didn't manage to debug what is causing the segfault inside the InsertionSort method (https://github.com/matouskozak/runtime/blob/a103efd28d46af39fc22a77458a11d204226e8d4/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs#L255)
It would be great to find out the root cause, because we have occasional other crash reports that look similar but are not easily reproducible. I think something is causing this instability in the runtime but this is the first time I've actually been able to reproduce it.
I put all the Clipper2 source into one .cs file for easy reproduction of the issue, I could upload that (with a repro) if that would help?
Edit to say: although it's good news that it appears fixed in .net 9, please bear in mind that .net 9 is entirely fictional for the purposes of anyone working on a real-world app that customers are using in production.
into one .cs file for easy reproduction of the issue, I could upload that (with a repro) if that would help?
Sure, if you have already done it feel free to share it together with repro steps and I can try if that helps reproducing it.
Edit to say: although it's good news that it appears fixed in .net 9, please bear in mind that .net 9 is entirely fictional for the purposes of anyone working on a real-world app that customers are using in production.
Yes, I understand that not everyone is (will be) on .NET 9. I'm happy that you have found a workaround to unblock yourself but I will still take a look to see what is the root cause. Especially since you are saying that your app is crashing similarly in other situations as well.
Sure, here you go. It's a single .cs file that contains all of Clipper2, and contains the buggy implementation of ConvertHorzSegsToJoins which uses a sorter method on a newly-initialised struct. Just include this one file in any project, and the few lines of code in my OP which will trigger the crash. I reproduced it on net7-ios and net8-ios.
This might be another instance of https://github.com/dotnet/runtime/issues/103569 (ie: we're still waiting for a .NET 8 servicing release that includes https://github.com/dotnet/runtime/pull/101491)
@matouskozak if you can get a servicing candidate from https://aka.ms/release-tracker you can try the repro there to see if we have a fix in already
@matouskozak if you can get a servicing candidate from https://aka.ms/release-tracker you can try the repro there to see if we have a fix in already
I've tried it on simulator and the servicing release didn't fix it for me.
@matouskozak I tried .net 8.0.7 just now and didn't get a crash:
Clipper2.cs
from https://github.com/dotnet/runtime/issues/98410#issuecomment-2011995461dotnet new maui
Edit MainPage.xaml.cs
to add a new public static void RunClipper()
method with the code from the "Reproduction Steps", above, and call it from OnCounterClicked
private void OnCounterClicked(object sender, EventArgs e)
{
count++;
RunClipper();
if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";
SemanticScreenReader.Announce(CounterBtn.Text);
}
dotnet build -f net8.0-ios -c Release -t:Run
and click on the button@matouskozak I tried .net 8.0.7 just now and didn't get a crash:
- Take
Clipper2.cs
from Runtime Crash (SIGSEGV) on iOS #98410 (comment)dotnet new maui
Edit
MainPage.xaml.cs
to add a newpublic static void RunClipper()
method with the code from the "Reproduction Steps", above, and call it fromOnCounterClicked
private void OnCounterClicked(object sender, EventArgs e) { count++; RunClipper(); if (count == 1) CounterBtn.Text = $"Clicked {count} time"; else CounterBtn.Text = $"Clicked {count} times"; SemanticScreenReader.Announce(CounterBtn.Text); }
dotnet build -f net8.0-ios -c Release -t:Run
and click on the button
Thank you @lambdageek. You're right, MAUI app is not crashing for me either. In my previous comment https://github.com/dotnet/runtime/issues/98410#issuecomment-2202192429 I tried it on the old Xamarin App and I suppose it didn't use the 8.0.7 servicing even though I installed it before. Which is logical because Xamarin iOS is out of support already.
Closing this issue as resolved. @divil5000 let us know if you're still encountering issues even after installing the 8.0.7 runtime servicing release.
@matouskozak I tried .net 8.0.7 just now and didn't get a crash:
- Take
Clipper2.cs
from Runtime Crash (SIGSEGV) on iOS #98410 (comment)dotnet new maui
Edit
MainPage.xaml.cs
to add a newpublic static void RunClipper()
method with the code from the "Reproduction Steps", above, and call it fromOnCounterClicked
private void OnCounterClicked(object sender, EventArgs e) { count++; RunClipper(); if (count == 1) CounterBtn.Text = $"Clicked {count} time"; else CounterBtn.Text = $"Clicked {count} times"; SemanticScreenReader.Announce(CounterBtn.Text); }
dotnet build -f net8.0-ios -c Release -t:Run
and click on the button
Thank you @lambdageek. You're right, MAUI app is not crashing for me either. In my previous comment https://github.com/dotnet/runtime/issues/98410#issuecomment-2202192429 I tried it on the old Xamarin App and I suppose it didn't use the 8.0.7 servicing even though I installed it before. Which is logical because Xamarin iOS is out of support already.
Closing this issue as resolved. @divil5000 let us know if you're still encountering issues even after installing the 8.0.7 runtime servicing release and using MAUI instead of Xamarin.
Assuming you were still checking out the old version of Clipper2 that triggered the problem, that's great news! I no longer have a test environment for this on my machine so will have to take your word for it.
We use neither Xamarin nor MAUI. We use net8.0-ios.
Description
We use a polygon clipping library (Clipper2) which is available as a NuGet package and whose source is here on Github. When calling a method in the library to inflate a large polygon, the .net runtime crashes. It appears to be a native crash - the Visual Studio debugger does not intercept it, and I therefore cannot get a helpful stack trace for the crash. The native stuff that is dumped to the output window is below.
I am no expert on this low-level stuff and would appreciate any help from looking at the debug output as to where things might be going wrong. The library is mostly doing number-crunching. Its full source can be forked at https://github.com/AngusJohnson/Clipper2/.
Reproduction Steps
This code creates a large polygon and calls the InflatePaths method in the library to expand the polygon.
Expected behavior
No crash
Actual behavior
Regression?
No response
Known Workarounds
So far I have not been able to devise a workaround.
Configuration
The code is currently being compiled for net7-ios. We cannot move to .net8-ios because that seems to have a minimum iOS version of 11, and we need to support 10.
Other information
No response