KERN_PROTECTION_FAILURE crash after loading a source containing NaN values


#1

Hi all,

My app is crashing once I have reloaded my source where some point have NaN value on Y axis.
I can’t understand why sometimes it is crashing but sometimes not (looks like it depends the number of datapoints and/or the number of NaN inside the serie).

My app is built Xamarin (Xamarin.iOS 8.9.1.3) .
The crash is not happening on the Android version of the app (same data used for android dataadapter than in the iOS datasource).
The crash is happening on device and simulator, under iOS 7.1.1 and 8.1.3.
The ShinoboChart version used is 2.7.3.3 of iOS, 1.7.0 for Android.

Here the crash report: https://gist.github.com/ggirard-distech/25e71b54605ca4724ab8
Here a dump of the datasource content: https://gist.github.com/ggirard-distech/e90f9a533ddaaf5c9159
Some logs from output console:

Apr 29 19:17:29 RnDs-iPad DistechX50UITouch[284] <Warning>: dcX50Model: Warning: 37,39 Retrieving LogRecord data from TREND600001 completed
Apr 29 19:17:30 RnDs-iPad DistechX50UITouch[284] <Warning>: dcX50Model: Warning: 38,36 Parsing LogRecord from TREND600001 ...
Apr 29 19:17:30 RnDs-iPad DistechX50UITouch[284] <Warning>: dcX50ModelPoller: Diagnostic: 38,50 Worker 6 started for 0 scheduled actions
Apr 29 19:17:30 RnDs-iPad DistechX50UITouch[284] <Warning>: dcX50ModelPoller: Diagnostic: 38,50 Finished 0 scheduled actions
Apr 29 19:17:30 RnDs-iPad DistechX50UITouch[284] <Warning>: dcX50Core: Diagnostic: 38,73 Trend log TREND600001 has now 292 records after refreshing
Apr 29 19:17:30 RnDs-iPad DistechX50UITouch[284] <Warning>: dcX50Core: Diagnostic: 38,74 Completed manual refresh on Distech.X50.Core.ViewModels.Charts.TrendLogViewModel(1059334477)
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: ShinobiCharts: Range minimum and maximum can't be infinite nor nans
	From: SChartNumberAxis at 0x19f289a0, axisRange = { -0.550000, 0.550000 }, defaultRange = { nan, 86.424954 }, maxRange = { 0.000000, 86.424954 }
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: Stacktrace:
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: at <unknown> <0xffffffff>
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: at UIKit.UIApplication.Main (string[],string,string) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: at Distech.X50.UI.Touch.Application.Main (string[]) [0x00001] in c:\TFS\Mobile\x50\Main\Src\Distech.X50.UI.Touch\Main.cs:17
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Apr 29 19:17:31 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 
	Native stacktrace:
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 0 DistechX50UITouch 0x01d1bf87 mono_handle_native_sigsegv + 238
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 1 DistechX50UITouch 0x01d2135f sigabrt_signal_handler + 102
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 2 libsystem_platform.dylib 0x38591f93 _sigtramp + 42
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 3 libsystem_pthread.dylib 0x38597797 pthread_kill + 58
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 4 libsystem_c.dylib 0x384ddfdd abort + 76
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 5 DistechX50UITouch 0x000ea237 +[ShinobiChartLog fatalLogMessage:fromSource:] + 54
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 6 DistechX50UITouch 0x00040dcb -[SChartAxis setRangeInternalWithMinimum:andMaximum:withAnimation:usingBounceLimits:] + 1186
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 7 DistechX50UITouch 0x00056175 -[SChartNumberAxis setRangeInternalWithMinimum:andMaximum:withAnimation:usingBounceLimits:] + 548
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 8 DistechX50UITouch 0x00041405 -[SChartAxis setRangeInternalWithMinimum:andMaximum:withAnimation:] + 92
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 9 DistechX50UITouch 0x0004b093 -[SChartAxis resetZoomLevelWithAnimation:] + 274
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 10 DistechX50UITouch 0x000c4311 -[ShinobiChart updateRangesOnAxis:] + 212
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 11 DistechX50UITouch 0x000c17ef -[ShinobiChart updateChartWithNewChartSeries:newSeriesGroups:] + 1974
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 12 DistechX50UITouch 0x000c252b -[ShinobiChart layoutSubviews] + 1206
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 13 UIKit 0x2fca1d79 <redacted> + 380
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 14 QuartzCore 0x2f91f62b <redacted> + 142
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 15 QuartzCore 0x2f91ae3b <redacted> + 350
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 16 QuartzCore 0x2f91accd <redacted> + 16
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 17 QuartzCore 0x2f91a6df <redacted> + 230
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 18 QuartzCore 0x2f91a4ef <redacted> + 314
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 19 QuartzCore 0x2f91421d <redacted> + 56
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 20 CoreFoundation 0x2d4512a5 <redacted> + 20
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 21 CoreFoundation 0x2d44ec49 <redacted> + 284
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 22 CoreFoundation 0x2d44ef8b <redacted> + 730
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 23 CoreFoundation 0x2d3b9f0f CFRunLoopRunSpecific + 522
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 24 CoreFoundation 0x2d3b9cf3 CFRunLoopRunInMode + 106
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 25 GraphicsServices 0x322b3663 GSEventRunModal + 138
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 26 UIKit 0x2fd0516d UIApplicationMain + 1136
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 27 DistechX50UITouch 0x009c1e34 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 272
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 28 DistechX50UITouch 0x009538a0 UIKit_UIApplication_Main_string___intptr_intptr + 52
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 29 DistechX50UITouch 0x00953860 UIKit_UIApplication_Main_string___string_string + 204
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 30 DistechX50UITouch 0x0017a9b0 Distech_X50_UI_Touch_Application_Main_string__ + 140
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 31 DistechX50UITouch 0x0051f954 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 32 DistechX50UITouch 0x01d287a7 mono_jit_runtime_invoke + 1190
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 33 DistechX50UITouch 0x01d70261 mono_runtime_invoke + 88
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 34 DistechX50UITouch 0x01d7380f mono_runtime_exec_main + 282
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 35 DistechX50UITouch 0x01d7364f mono_runtime_run_main + 502
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 36 DistechX50UITouch 0x01d12839 mono_jit_exec + 48
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 37 DistechX50UITouch 0x01dd6b18 xamarin_main + 2148
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 38 DistechX50UITouch 0x01cf4bf5 main + 112
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 39 libdyld.dylib 0x38477ab7 <redacted> + 2
Apr 29 19:17:32 RnDs-iPad DistechX50UITouch[284] <Warning>: critical: 
	=================================================================
	Got a SIGABRT while executing native code. This usually indicates
	a fatal error in the mono runtime or one of the native libraries 
	used by your application.
	=================================================================
Apr 29 19:17:32 RnDs-iPad ReportCrash[286] <Notice>: ReportCrash acting against PID 284
Apr 29 19:17:32 RnDs-iPad ReportCrash[286] <Notice>: Formulating crash report for process DistechX50UITouch[284]
Apr 29 19:17:32 RnDs-iPad com.apple.launchd[1] (UIKitApplication:com.distech.x50.ui.touch[0x4e79][284]) <Warning>: (UIKitApplication:com.distech.x50.ui.touch[0x4e79]) Job appears to have crashed: Abort trap: 6
Apr 29 19:17:32 RnDs-iPad ReportCrash[286] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/DistechX50UITouch_2015-04-29-191732_RnDs-iPad.ips using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
Apr 29 19:17:32 RnDs-iPad backboardd[29] <Warning>: Application 'UIKitApplication:com.distech.x50.ui.touch[0x4e79]' exited abnormally with signal 6: Abort trap: 6

Another fact: when the crash is not happening, If I check for axis data range with something like 

chart.YAxis.DataRange

then the range is -0.5;0.5 whereas my data Y values are comprised between 0.0 and 100.00 with some NaN values between!

I will try to setup a demo project to reproduce the issue.
In the meantime, can anybody indicate if they encoutered this kind of issue?

Thanks,

Guillaume.


#2

Hi Guillaume,

Without seeing your datasource method it’s a little tricky to deduce what is causing the issue, although I have a feeling it will be the “NaN” values.

Could I ask what kind of series are you using?

How are you passing the “NaNs” to the chart, are they nil or being passed as a string? e.g.

SChartDataPoint *dp = [SChartDataPoint new];
dp.xValue = <some_value>;

if ([yValueString isEqualToString:@"NaN"]) {
     dp.yValue = nil;
}

If you could send us that sample that’d be a great help in solving this issue!

Many thanks,

Sam


#3

Hi Sam,

I have created the sample and uploaded it on my drive here http://1drv.ms/1PEqOge
You will find 2 charts containing NaN values, one without issue and the other with the crash.

I am using an SChartLineSeries.
Concerning the values… Xamarin does the “magic” for me while converting from the System.Single managed type to NSNumber native type.
Looks like they are initializing an instance of NSNumber by passing the float value to 

+ (NSNumber *)numberWithFloat:(float)value

I guess they have properly bound it as it is a pretty common feature…

I can’t understand why the crash seems to appear only when the point number is bellow a certain amount (I have approximated it to 700 during my tests).
Any idea?

Thanks,

Guillaume.


#4

Using null instead of NaN value fixed the issue (even within the working sample, axis ranges were wrong…).

Regarding the crash, it seems to happen only if the serie contains NaN values but the first entry is not a NaN.
If the value is a NaN, there is no crash.


#5

Hi Guillaume,

Glad to hear you have solved your issue. :slight_smile:

This is due to us only accepting null values to be entered as values, therefore when inserting NaN or NSNull values you get a crash.

For the time being, we recommend replacing any of the above values with null.

Kind regards,
Andrew Polkinghorn