FFImageLoading fails load big Gif file when executing real device - xamarin

My Xamarin.Forms app uses FFImageLoading for loading three Gifs.
A.gif : 3.7MB
B.gif : 5.1MB
C.gif : 2MB
(These Gifs created by DavinciResolve)
My app preload Gifs as following.
public static async void PreloadTutorialGifs()
{
try
{
var targetWidth = 500;
var targetHeight = 1000;
await ImageService.Instance.LoadFileFromApplicationBundle("A.gif").Success((info, result) =>
{
Debug.WriteLine($"A.gif Preloading finished! Key: {info.CacheKey}");
})
.CacheKey("A.gif")
.DownSample(targetWidth, targetHeight)
.PreloadAsync();
await ImageService.Instance.LoadFileFromApplicationBundle("B.gif").Success((info, result) =>
{
Debug.WriteLine($"B.gif Preloading finished! Key: {info.CacheKey}");
})
.CacheKey("B.gif")
.DownSample(targetWidth, targetHeight)
.PreloadAsync();
await ImageService.Instance.LoadFileFromApplicationBundle("C.gif").Success((info, result) =>
{
Debug.WriteLine($"C.gif Preloading finished! Key: {info.CacheKey}");
})
.CacheKey("C.gif")
.DownSample(targetWidth, targetHeight)
.PreloadAsync();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Utility.SendExceptionToCrashlytics(ex);
}
}
[simulator output]
2022-12-20 09:02:05.134347+0900 SoccerScoreApp.iOS[53533:1012657] FFImageLoading log: Image memory cache size: 3276.8 MB
2022-12-20 09:02:05.505321+0900 SoccerScoreApp.iOS[53533:1013047] FFImageLoading log: Generating/retrieving image: A.gif
A.gif Preloading finished! Key: A.gif
2022-12-20 09:02:14.867980+0900 SoccerScoreApp.iOS[53533:1013177] FFImageLoading log: Generating/retrieving image: B.gif
change_player_tutorial.gif Preloading finished! Key: B.gif
2022-12-20 09:02:23.464188+0900 SoccerScoreApp.iOS[53533:1013178] FFImageLoading log: Generating/retrieving image: C.gif
card_tutorial.gif Preloading finished! Key: C.gif
[real device output]
022-12-19 08:25:35.176 SoccerScoreApp.iOS[1020:52406] FFImageLoading log: Image memory cache size: 591.97 MB
022-12-19 08:25:35.850 SoccerScoreApp.iOS[1020:52464] FFImageLoading log: Generating/retrieving image: A.gif
=================================================================
Native Crash Reporting
=================================================================
Got a segv 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:
=================================================================
0x10755ea58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107554ba4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107562ed0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x249b95c10 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x1da598340 - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da5a971c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da5a969c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da5a8f4c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3dc62c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3d800c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3e018c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da7cc7d4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7eebf4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da80e784 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7eebf4 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7c9550 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : CGAccessSessionCreate
0x1da790264 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7dda5c - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7abe9c - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da7cb9e0 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : <redacted>
0x1da79d068 - /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics : CGContextDrawImageWithOptions
0x1da3f6d5c - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3e4318 - /System/Library/Frameworks/ImageIO.framework/ImageIO : <redacted>
0x1da3cf634 - /System/Library/Frameworks/ImageIO.framework/ImageIO : CGImageSourceCreateThumbnailAtIndex
0x103e6aac8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10326f330 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106102c2c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106116918 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061775a4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10610028c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106115030 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061772b4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1060fffbc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106214990 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107620ae4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10754b0cc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012dd610 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100fe2cf4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061d2910 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10621f8c4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107620ae4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10754b0cc - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012dd610 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100fe2934 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061d35f8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1062271e4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1062e3f94 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1061dde58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x10623ab90 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1062ed5ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x106224a5c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bd2ab8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bdeaf4 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bded68 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100ba75ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100ba73ec - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100be5048 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bdec80 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bdeb58 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bb1348 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x103a2fd70 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x100bb3408 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x1012d8480 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight
0x107566318 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x1076223d0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107665634 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x107662ea8 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10766e63c - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x10766e4c0 - /private/var/containers/Bundle/Application/E6BD92CA-CDBF-4B68-BE92-A90D6BC10226/SoccerScoreApp.iOS.app/SoccerScoreApp.iOS : mono_pmip
0x249b9d9ac - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
0x249b9ce68 - /usr/lib/system/libsystem_pthread.dylib : thread_start
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x249b94a9c):0x249b94a8c 21 00 05 8b 20 04 40 ac 21 80 00 91 42 00 05 cb !... .#.!...B...
0x249b94a9c 02 0c 00 ac 42 00 01 f1 e9 00 00 54 60 04 00 ac ....B......T`...
0x249b94aac 63 80 00 91 20 04 40 ac 21 80 00 91 42 80 00 f1 c... .#.!...B...
0x249b94abc 68 ff ff 54 21 00 02 8b 22 0c 40 ac 60 04 00 ac h..T!...".#.`...
=================================================================
Managed Stacktrace:
=================================================================
at <unknown> <0xffffffff>
at ImageIO.CGImageSource:CGImageSourceCreateThumbnailAtIndex <0x00007>
at ImageIO.CGImageSource:CreateThumbnail <0x0006f>
at FFImageLoading.Decoders.GifDecoder:GetFrames <0x0012b>
at <SourceRegfToDecodedImageAsync>d__2:MoveNext <0x01407>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
at FFImageLoading.Decoders.GifDecoder:SourceRegfToDecodedImageAsync <0x0026b>
at <DecodeAsync>d__1:MoveNext <0x0055f>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
at FFImageLoading.Decoders.GifDecoder:DecodeAsync <0x0024b>
at <GenerateImageAsync>d__104:MoveNext <0x0030f>
at System.Object:runtime_invoke_dynamic <0x0010f>
at <unknown> <0xffffffff>
at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00173>
at FFImageLoading.Work.ImageLoaderTask`3:GenerateImageAsync <0x002cf>
at <RunAsync>d__109:MoveNext <0x01ed3>
at System.Object:runtime_invoke_dynamic <0x0010f>
at <unknown> <0xffffffff>
at System.Object:__icall_wrapper_mono_gsharedvt_constrained_call <0x00007>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00173>
at FFImageLoading.Work.ImageLoaderTask`3:RunAsync <0x00187>
at <RunImageLoadingTaskAsync>d__49:MoveNext <0x00993>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00173>
at FFImageLoading.Work.WorkScheduler:RunImageLoadingTaskAsync <0x001a7>
at <<TakeFromPendingTasksAndRunAsync>b__3>d:MoveNext <0x000ff>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x0019b>
at <>c__DisplayClass48_0:<TakeFromPendingTasksAndRunAsync>b__3 <0x0016b>
at System.Threading.Tasks.Task`1:InnerInvoke <0x00057>
at System.Threading.Tasks.Task:Execute <0x00023>
at System.Threading.Tasks.Task:ExecutionContextCallback <0x00057>
at System.Threading.ExecutionContext:RunInternal <0x001ab>
at System.Threading.ExecutionContext:Run <0x0002b>
at System.Threading.Tasks.Task:ExecuteWithThreadLocal <0x00127>
at System.Threading.Tasks.Task:ExecuteEntry <0x0010f>
at System.Threading.Tasks.Task:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem <0x00017>
at System.Threading.ThreadPoolWorkQueue:Dispatch <0x001e7>
at ObjCRuntime.Runtime:ThreadPoolDispatcher <0x0003f>
at System.Threading._ThreadPoolWaitCallback:PerformWaitCallback <0x00087>
at System.Object:runtime_invoke_dynamic <0x0010f>
=================================================================
[My FinishedLaunching method]
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
CachedImageRenderer.Init();
CachedImageRenderer.InitImageSourceHandler();
var config = new FFImageLoading.Config.Configuration()
{
VerboseLogging = true,
VerbosePerformanceLogging = true,
VerboseMemoryCacheLogging = true,
VerboseLoadingCancelledLogging = true,
Logger = new CustomLogger(),
MaxMemoryCacheSize = 20000000
};
ImageService.Instance.Initialize(config);
[CustomLogger]
public class CustomLogger : FFImageLoading.Helpers.IMiniLogger
{
public void Debug(string message)
{
Console.WriteLine($"FFImageLoading log: {message}");
}
public void Error(string errorMessage)
{
Console.WriteLine($"FFImageLoading error log: {errorMessage}");
}
public void Error(string errorMessage, Exception ex)
{
Error(errorMessage + System.Environment.NewLine + ex.ToString());
}
}
How can i fix this?
My Environment
Xamarin.Forms : 5.0.0.2478
Xamarin.FFImageLoading : 2.4.11.982
Xamarin.FFImageLoading.Forms : 2.4.11.982
MarcTron.Admob : 1.9.0.3
Success Simulators
iPhone SE(2nd generation) iOS 16.1
iPhone SE(3rd generation) iOS 16.1
iPhone 14 iOS 16.1
My Real Device
iPhone SE(2nd generation) iOS 16.2(15.x)

What is original width and height of gif.A?
How many frames?
In memory each pixel takes 4 bytes. Multiply "4 * original width * height * #frames".
What value do you get? That's what will be needed in cache size to "load the gif". Note that it doesn't matter how small the file is on disk; that is "compressed" size. In memory, it is not compressed. It also doesn't matter how small you are downsampling to; it first loads at the original size [I think].
To fix, do EITHER:
In an image editor, shrink to a smaller width/height.
OR Set a custom cache size for FFImageLoader, from Memory size is greater than image sizes?:
var config = new FFImageLoading.Config.Configuration()
{
MaxMemoryCacheSize = 9999999, // Try different values here. Bigger uses more app memory.
};
ImageService.Instance.Initialize(config);

Related

Async IO operation failed (1), reason: RC: 32 Broken pipe IN SPRING mvc rest service

How to set connection timeout to only particular to that rest spring mvc request.
I want to render huge data of clothes on browser but server send an connection timeout error.
#RequestMapping(value="/clothes/{clothType}/properties", method = RequestMethod.GET)
public #ResponseBody List<Clothes> getClothesList(#PathVariable String clothType, HttpServletResponse response) {
List<Clothes> listClothes;
try {
listClothes = ClothesApiService.getClothesProperties(clothType);
} catch (Exception e) {
log.info("Problem getting the properties for Clothes " + clothType + ". Error: " + e.getMessage());
}
return listClothes;
}
Below is stack trace on IBM server logs
at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1613) ~[jackson-all-1.9.11.jar:1.9.11]
128 at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:140) ~[org.springframework.web-3.1.4.RELEASE.jar:3.1.4.RELEASE]
129 ... 49 common frames omitted
130 Caused by: java.io.IOException: Async IO operation failed (1), reason: RC: 32 Broken pipe
131 at com.ibm.io.async.AsyncLibrary$IOExceptionCache.(AsyncLibrary.java:891) ~[com.ibm.ws.runtime.jar:na]
132 at com.ibm.io.async.AsyncLibrary$IOExceptionCache.get(AsyncLibrary.java:904) ~[com.ibm.ws.runtime.jar:na]
133 at com.ibm.io.async.AsyncLibrary.getIOException(AsyncLibrary.java:918) ~[com.ibm.ws.runtime.jar:na]
134 at com.ibm.io.async.AbstractAsyncChannel.multiIO(AbstractAsyncChannel.java:473) ~[com.ibm.ws.runtime.jar:na]
135 at com.ibm.io.async.AsyncSocketChannelHelper.write(AsyncSocketChannelHelper.java:478) ~[com.ibm.ws.runtime.jar:na]
136 at com.ibm.io.async.AsyncSocketChannelHelper.write(AsyncSocketChannelHelper.java:396) ~[com.ibm.ws.runtime.jar:na]
137 at com.ibm.ws.tcp.channel.impl.AioSocketIOChannel.writeAIO(AioSocketIOChannel.java:282) ~[com.ibm.ws.runtime.jar:na]
138 at com.ibm.ws.tcp.channel.impl.AioTCPWriteRequestContextImpl.processAsyncWriteRequest(AioTCPWriteRequestContextImpl.java:53) ~[com.ibm.ws.runtime.jar:na]
139 at com.ibm.ws.tcp.channel.impl.TCPWriteRequestContextImpl.writeInternal(TCPWriteRequestContextImpl.java:382) ~[na:CC70.CF [a0849.02]]
140 at com.ibm.ws.tcp.channel.impl.TCPWriteRequestContextImpl.write(TCPWriteRequestContextImpl.java:353) ~[na:CC70.CF [a0849.02]]
141 at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.asynchWrite(HttpServiceContextImpl.java:2442) ~[com.ibm.ws.runtime.jar:na]
142 at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.sendOutgoing(HttpServiceContextImpl.java:2229) ~[com.ibm.ws.runtime.jar:na]
143 at com.ibm.ws.http.channel.inbound.impl.HttpInboundServiceContextImpl.sendResponseBody(HttpInboundServiceContextImpl.java:866) ~[com.ibm.ws.runtime.jar:na]
144 at com.ibm.ws.webcontainer.channel.WCChannelLink.writeBufferAsynch(WCChannelLink.java:551) [com.ibm.ws.webcontainer.jar:na]
145 at com.ibm.ws.webcontainer.channel.WCChannelLink.writeBufferResponse(WCChannelLink.java:528) [com.ibm.ws.webcontainer.jar:na]
146 at com.ibm.ws.webcontainer.channel.WCChannelLink.writeBuffer(WCChannelLink.java:472) [com.ibm.ws.webcontainer.jar:na]
147 at com.ibm.ws.webcontainer.channel.WCCByteBufferOutputStream.flushWriteBuffer(WCCByteBufferOutputStream.java:406) ~[com.ibm.ws.webcontainer.jar:na]
148 at com.ibm.ws.webcontainer.channel.WCCByteBufferOutputStream.checkWriteArray(WCCByteBufferOutputStream.java:378) ~[com.ibm.ws.webcontainer.jar:na]
149 at com.ibm.ws.webcontainer.channel.WCCByteBufferOutputStream.write(WCCByteBufferOutputStream.java:111) ~[com.ibm.ws.webcontainer.jar:na]
150 at com.ibm.ws.webcontainer.srt.SRTOutputStream.write(SRTOutputStream.java:97) ~[com.ibm.ws.webcontainer.jar:na]
151 at com.ibm.wsspi.webcontainer.util.BufferedServletOutputStream.writeOut(BufferedServletOutputStream.java:569) ~[com.ibm.ws.webcontainer.jar:na]
152 at com.ibm.wsspi.webcontainer.util.BufferedServletOutputStream.flushBytes(BufferedServletOutputStream.java:433) ~[com.ibm.ws.webcontainer.jar:na]
153 at com.ibm.wsspi.webcontainer.util.BufferedServletOutputStream.write(BufferedServletOutputStream.java:383) ~[com.ibm.ws.webcontainer.jar:na]
154 at org.codehaus.jackson.impl.Utf8Generator._flushBuffer(Utf8Generator.java:1754) ~[jackson-all-1.9.11.jar:1.9.11]
155 at org.codehaus.jackson.impl.Utf8Generator.writeString(Utf8Generator.java:561) ~[jackson-all-1.9.11.jar:1.9.11]
156 at org.codehaus.jackson.map.ser.std.StringSerializer.serialize(StringSerializer.java:28) ~[jackson-all-1.9.11.jar:1.9.11]
157 at org.codehaus.jackson.map.ser.std.StringSerializer.serialize(StringSerializer.java:18) ~[jackson-all-1.9.11.jar:1.9.11]
158 at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) ~[jackson-all-1.9.11.jar:1.9.11]
159 ... 58 common frames omitted
Below is my code
#RequestMapping(value="/clothes/{clothType}/properties", method = RequestMethod.GET)
public #ResponseBody List<Clothes> getClothesList(#PathVariable String clothType, HttpServletResponse response) {
List<Clothes> listClothes;
try {
listClothes = ClothesApiService.getClothesProperties(clothType);
} catch (Exception e) {
log.info("Problem getting the properties for Clothes " + clothType + ". Error: " + e.getMessage());
}
return listClothes;
}

Embedded kafka not able to start - Error

I am having a hard time to fix this issue. Here is my Junit and i am using spring embedded kafka. When i run my test case i am getting weird issue/exception.
#RunWith(SpringRunner.class)
#SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
#ActiveProfiles("test")
#FixMethodOrder(MethodSorters.NAME_ASCENDING)
#DirtiesContext
public class WatchListUpdateTest {
#ClassRule
public static KafkaEmbedded KAFKA = new KafkaEmbedded(1, true, "abc");
#BeforeClass
public static void startKafka() throws Exception {
String kafkaBootstrapServers = KAFKA.getBrokersAsString();
System.out.print("[Embedded Kafka Server:{}]" + kafkaBootstrapServers);
System.setProperty("kafka.consumer.bootstrap.servers", kafkaBootstrapServers);
System.setProperty("kafka.producer.bootstrap.servers", kafkaBootstrapServers);
}
#Autowired
ApplicationContext applicationContext;
private KafkaTestHelper helper = new KafkaTestHelper(KAFKA, "abc");
#Before
public void setUp() throws Exception {
helper.start(KAFKA.getPartitionsPerTopic());
}
#After
public void tearDown() throws Exception {
helper.stop();
}
#Test
public void testIng() throws Exception {
}
}
and
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.listener.KafkaMessageListenerContainer;
import org.springframework.kafka.listener.MessageListener;
import org.springframework.kafka.listener.config.ContainerProperties;
import org.springframework.kafka.test.rule.KafkaEmbedded;
import org.springframework.kafka.test.utils.ContainerTestUtils;
import org.springframework.kafka.test.utils.KafkaTestUtils;
public class KafkaTestHelper {
private KafkaMessageListenerContainer < String, String > container;
private BlockingQueue < ConsumerRecord < String, String >> records;
public KafkaTestHelper(KafkaEmbedded KAFKA, String topics) {
Map < String, Object > consumerProperties = KafkaTestUtils.consumerProps("sender", "false", KAFKA);
DefaultKafkaConsumerFactory < String, String > consumerFactory = new DefaultKafkaConsumerFactory < String, String > (
consumerProperties);
ContainerProperties containerProperties = new ContainerProperties(topics);
container = new KafkaMessageListenerContainer < > (consumerFactory, containerProperties);
records = new LinkedBlockingQueue < > ();
container.setupMessageListener(new MessageListener < String, String > () {
#Override
public void onMessage(ConsumerRecord < String, String > record) {
records.add(record);
}
});
}
public void start(int numberOfPartitions) {
container.start();
try {
ContainerTestUtils.waitForAssignment(container, numberOfPartitions);
} catch (Exception e) {
e.printStackTrace();
}
}
public void stop() {
container.stop();
}
}
Here is my exception :
01: 38: 17.454[main - SendThread(127.0 .0 .1: 64964)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid: 0x16494b8ced60001, packet::clientPath: null serverPath: null finished: false header::27, 1 replyHeader::27, 18, -101 request::'/cluster/id,#7b2276657273696f6e223a2231222c226964223a22635f686f3459694d547643637a6849386465436d7841227d,v{s{31,s{'
world, 'anyone}}},0 response::
01: 38: 17.455[SyncThread: 0] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - Processing request::sessionid: 0x16494b8ced60001 type: create cxid: 0x1c zxid: 0x13 txntype: 1 reqpath: n / a
01: 38: 17.455[SyncThread: 0] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - sessionid: 0x16494b8ced60001 type: create cxid: 0x1c zxid: 0x13 txntype: 1 reqpath: n / a
01: 38: 17.455[main - SendThread(127.0 .0 .1: 64964)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid: 0x16494b8ced60001, packet::clientPath: null serverPath: null finished: false header::28, 1 replyHeader::28, 19, 0 request::'/cluster,,v{s{31,s{'
world, 'anyone}}},0 response:: ' / cluster
01: 38: 17.456[SyncThread: 0] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - Processing request::sessionid: 0x16494b8ced60001 type: create cxid: 0x1d zxid: 0x14 txntype: 1 reqpath: n / a
01: 38: 17.456[SyncThread: 0] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - sessionid: 0x16494b8ced60001 type: create cxid: 0x1d zxid: 0x14 txntype: 1 reqpath: n / a
01: 38: 17.456[main - SendThread(127.0 .0 .1: 64964)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid: 0x16494b8ced60001, packet::clientPath: null serverPath: null finished: false header::29, 1 replyHeader::29, 20, 0 request::'/cluster/id,#7b2276657273696f6e223a2231222c226964223a22635f686f3459694d547643637a6849386465436d7841227d,v{s{31,s{'
world, 'anyone}}},0 response:: ' / cluster / id
01: 38: 17.457[main] INFO kafka.server.KafkaServer - Cluster ID = c_ho4YiMTvCczhI8deCmxA
01: 38: 17.460[main] WARN kafka.server.BrokerMetadataCheckpoint - No meta.properties file under dir /
var / folders / _s / k06t9c8x7470lcccm39r96fc0000gp / T / kafka - 72082059269987836 / meta.properties
01: 38: 17.482[ThrottledRequestReaper - Fetch] INFO kafka.server.ClientQuotaManager$ThrottledRequestReaper - [ThrottledRequestReaper - Fetch], Starting
01: 38: 17.483[main] DEBUG org.apache.kafka.common.metrics.Metrics - Added sensor with name Fetch - delayQueue
01: 38: 17.484[main] DEBUG org.apache.kafka.common.metrics.Metrics - Added sensor with name Produce - delayQueue
01: 38: 17.484[ThrottledRequestReaper - Produce] INFO kafka.server.ClientQuotaManager$ThrottledRequestReaper - [ThrottledRequestReaper - Produce], Starting
01: 38: 17.519[SyncThread: 0] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - Processing request::sessionid: 0x16494b8ced60001 type: getChildren cxid: 0x1e zxid: 0xfffffffffffffffe txntype: unknown reqpath: /brokers/topics
01: 38: 17.519[SyncThread: 0] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - sessionid: 0x16494b8ced60001 type: getChildren cxid: 0x1e zxid: 0xfffffffffffffffe txntype: unknown reqpath: /brokers/topics
01: 38: 17.520[main - SendThread(127.0 .0 .1: 64964)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid: 0x16494b8ced60001, packet::clientPath: null serverPath: null finished: false header::30, 8 replyHeader::30, 20, 0 request::'/brokers/topics,F response:: v{}
01: 38: 17.540[main] INFO kafka.log.LogManager - Loading logs.
01: 38: 17.546[main] INFO kafka.log.LogManager - Logs loading complete in 6 ms.
01: 38: 17.567[main] INFO kafka.log.LogManager - Starting log cleanup with a period of 300000 ms.
01: 38: 17.568[main] DEBUG kafka.utils.KafkaScheduler - Scheduling task kafka - log - retention with initial delay 30000 ms and period 300000 ms.
01: 38: 17.569[main] INFO kafka.log.LogManager - Starting log flusher with a
default period of 9223372036854775807 ms.
01: 38: 17.569[main] DEBUG kafka.utils.KafkaScheduler - Scheduling task kafka - log - flusher with initial delay 30000 ms and period 9223372036854775807 ms.
01: 38: 17.570[main] DEBUG kafka.utils.KafkaScheduler - Scheduling task kafka - recovery - point - checkpoint with initial delay 30000 ms and period 60000 ms.
01: 38: 17.570[main] DEBUG kafka.utils.KafkaScheduler - Scheduling task kafka - delete - logs with initial delay 30000 ms and period 60000 ms.
01: 38: 17.571[main] INFO kafka.log.LogCleaner - Starting the log cleaner
01: 38: 17.572[kafka - log - cleaner - thread - 0] INFO kafka.log.LogCleaner - [kafka - log - cleaner - thread - 0], Starting
01: 38: 17.600[main] ERROR kafka.server.KafkaServer - [Kafka Server 0], Fatal error during KafkaServer startup.Prepare to shutdown
java.lang.NoSuchMethodError: org.apache.kafka.common.network.ChannelBuilders.serverChannelBuilder(Lorg / apache / kafka / common / protocol / SecurityProtocol; Ljava / util / Map; Lorg / apache / kafka / common / security / authenticator / CredentialCache;) Lorg / apache / kafka / common / network / ChannelBuilder;
at kafka.network.Processor. < init > (SocketServer.scala: 422)
at kafka.network.SocketServer.newProcessor(SocketServer.scala: 145)
at kafka.network.SocketServer$$anonfun$startup$1$$anonfun$apply$1.apply$mcVI$sp(SocketServer.scala: 96)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala: 160)
at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala: 95)
at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala: 90)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala: 59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala: 48)
at kafka.network.SocketServer.startup(SocketServer.scala: 90)
at kafka.server.KafkaServer.startup(KafkaServer.scala: 215)
at kafka.utils.TestUtils$.createServer(TestUtils.scala: 124)
at kafka.utils.TestUtils.createServer(TestUtils.scala)
at org.springframework.kafka.test.rule.KafkaEmbedded.before(KafkaEmbedded.java: 156)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java: 46)
at org.junit.rules.RunRules.evaluate(RunRules.java: 20)
at org.junit.runners.ParentRunner.run(ParentRunner.java: 363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java: 191)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java: 86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java: 38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java: 460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 206)
01: 38: 17.601[main] INFO kafka.server.KafkaServer - [Kafka Server 0], shutting down
01: 38: 17.603[main] INFO kafka.network.SocketServer - [Socket Server on Broker 0], Shutting down
01: 38: 17.604[main] WARN kafka.utils.CoreUtils$ - null
java.lang.NullPointerException: null
at kafka.network.SocketServer$$anonfun$shutdown$3.apply(SocketServer.scala: 129)
at kafka.network.SocketServer$$anonfun$shutdown$3.apply(SocketServer.scala: 129)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala: 33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala: 186)
at kafka.network.SocketServer.shutdown(SocketServer.scala: 129)
at kafka.server.KafkaServer$$anonfun$shutdown$2.apply$mcV$sp(KafkaServer.scala: 582)
at kafka.utils.CoreUtils$.swallow(CoreUtils.scala: 78)
at kafka.utils.Logging$class.swallowWarn(Logging.scala: 94)
at kafka.utils.CoreUtils$.swallowWarn(CoreUtils.scala: 48)
at kafka.utils.Logging$class.swallow(Logging.scala: 96)
at kafka.utils.CoreUtils$.swallow(CoreUtils.scala: 48)
at kafka.server.KafkaServer.shutdown(KafkaServer.scala: 582)
at kafka.server.KafkaServer.startup(KafkaServer.scala: 289)
at kafka.utils.TestUtils$.createServer(TestUtils.scala: 124)
at kafka.utils.TestUtils.createServer(TestUtils.scala)
at org.springframework.kafka.test.rule.KafkaEmbedded.before(KafkaEmbedded.java: 156)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java: 46)
at org.junit.rules.RunRules.evaluate(RunRules.java: 20)
at org.junit.runners.ParentRunner.run(ParentRunner.java: 363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java: 191)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java: 86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java: 38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java: 460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 206)
01: 38: 17.605[main] DEBUG kafka.utils.KafkaScheduler - Shutting down task scheduler.
01: 38: 17.606[main] INFO kafka.log.LogManager - Shutting down.
01: 38: 17.607[main] INFO kafka.log.LogCleaner - Shutting down the log cleaner.
01: 38: 17.608[main] INFO kafka.log.LogCleaner - [kafka - log - cleaner - thread - 0], Shutting down
01: 38: 17.608[kafka - log - cleaner - thread - 0] INFO kafka.log.LogCleaner - [kafka - log - cleaner - thread - 0], Stopped
01: 38: 17.608[main] INFO kafka.log.LogCleaner - [kafka - log - cleaner - thread - 0], Shutdown completed
I am using spring boot 1.5.4.RELEASE & kafka 0.11.0.0
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<version>1.5.4.RELEASE}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.11.0.0</version>
</dependency>
Please help me to resolve this issue, i had spent a lot of time but could not figure-out the issue. Thanks in advance.
After adding this dependancy it worked for me
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>${kafka.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</exclusion>
</exclusions>
</dependency>
This is the set of dependencies for Kafka 2.4.1, which may solve your issue (source: https://docs.spring.io/spring-kafka/reference/html/#update-deps):
where {kafka-version} is 2.4.1 and {springKafkaTest} is 2.4.8.RELEASE
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<version>{springKafkaTest}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>{kafka-version}</version>
<classifier>test</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.13</artifactId>
<version>{kafka-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.13</artifactId>
<version>{kafka-version}</version>
<classifier>test</classifier>
<scope>test</scope>
</dependency>

How to handle uncaughtErrorEvent & Exception to write a log in NativeScript?

var application = require("application");
application.on(application.uncaughtErrorEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an NativeScriptError.
console.log("NativeScriptError: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is NativeScriptError.
console.log("NativeScriptError: " + args.ios);
}
});
I tried above example in {N}#2.0.1 but it does not work for me.
Can you explain more detail?
Answered in NativeScript github repository enter link description here as follows:
application.uncaughtErrorEvent will trigger whenever your app is crashing and the cause is not handled.
For example:
if you try to initialize an android button with null context like this in your main-page.js it will throw an error
in main-page.js
var btn = new android.widget.Button(null);
What you can do to catch this error is to use uncaughtErrorEvent
in app.js
"use strict";
var application = require("application");
application.on(application.uncaughtErrorEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an NativeScriptError.
console.log(" *** NativeScriptError *** : " + args.android);
console.log(" *** StackTrace *** : " + args.android.stackTrace);
console.log(" *** nativeException *** : " + args.android.nativeException);
}
else if (args.ios) {
// For iOS applications, args.ios is NativeScriptError.
console.log("NativeScriptError: " + args.ios);
}
});
application.start({ moduleName: "main-page" });
From the log you can see the following information:
NativeScriptError : Error: The application crashed because of an uncaught exception.
from the stackTrace you can see the cause of this error :
Attempt to invoke virtual method 'android.content.res.Resources
android.content.Context.getResources()' on null reference object
You also have a pointer where the error has occured:
Frame: function:'navigatingTo', `file:'/data/data/org.nativescript.cameraUpload/files/app/main-page.js',
line: 11, column: 15`

How to reload all tabs at a particular time each day in a Chrome extension

I am trying to write a Chrome extension that can reload all Google Chrome tabs at 7AM. I have to do this every day and it will be nice to have a small program that does it for me. I have tried one of the existing extensions but it's not working correctly for me, so I've taken some existing code and am trying to make it do what I want:
219 updateMonitorSelectors: function () {
220 //p.ex.currentReload.monitor.selectors.length = 0;
221 if (p.v.isInitSelector) return;
222 p.ex.currentReload.monitor.selectors = [];
223 $(p.s.dMonitor_nu + ' input[type="text"]').each(function () {
224 var disabled = $(this).attr('disabled');
225 if (!disabled) {
226 p.ex.currentReload.monitor.selectors[p.ex.currentReload.moni tor.selectors.length] = $(this).val();
227 }
228 });
229 },
230 initControls: function () {
231 if (this.initControls.timerId) clearTimeout(this.initControls.timerI d);
232 if (p.ex.currentReload === null) { this.initControls.timerId = setTi meout('p.initControls()', 250); return; };
233 var reload = p.ex.currentReload;
234 $(p.s.tRandomStartSecs).val(reload.rand.from);
235 $(p.s.tRandomEndMins).val(reload.rand.to / 60);
236 $(p.s.tCustomSecs).val(reload.secs);
237 $(p.s.tDefaultSecs).val(p.ex.defaultTime);
238 if (reload.isTabRefresh) { $(p.s.rTab).attr('checked', 'checked'); }
239 else $(p.s.rUrl).attr('checked', 'checked');
240
241 if (reload.span.isStartOn) {
242 $(p.s.cStart).attr('checked', 'checked');
243 $(p.s.tStart).removeAttr('disabled');
244 $(p.s.tStart).val(p.time.toLocal(reload.span.startTime));
245 }
246 if (reload.span.isEndOn) {
247 $(p.s.cEnd).attr('checked', 'checked');
248 $(p.s.tEnd).removeAttr('disabled');
249 $(p.s.tEnd).val(p.time.toLocal(reload.span.endTime));
250 }
251

Xamarin.iOS SIGSEGV when trying to discover services of a connected BLE peripheral

I'm making a BLE cross-platform app in Xamarin, but fail to discover services of a connected peripheral.
Here's the stripped down code from the shared-project, just to be able to reproduce this issue;
internal class BleTransport
{
//Private stuff
private CBCentralManager Central = null;
private CBPeripheral CurrentPeripheral = null;
private bool IsScanning = false;
internal BleTransport ()
{
//Constructor -- initialize everything that needs to be initialized!
Central = new CBCentralManager (DispatchQueue.MainQueue);
//Setup delegates to the central's events
Central.UpdatedState += (object sender, EventArgs e) => CentralStateChanged.Set ();
Central.DiscoveredPeripheral += (object sender, CBDiscoveredPeripheralEventArgs e) => DiscoveredPeripheral (e.Peripheral, e.RSSI, e.AdvertisementData);
Central.ConnectedPeripheral += (object sender, CBPeripheralEventArgs e) => ConnectedPeripheral (e.Peripheral);
Central.FailedToConnectPeripheral += (object sender, CBPeripheralErrorEventArgs e) => FailedToConnectPeripheral (e.Error, e.Peripheral);
Central.DisconnectedPeripheral += (object sender, CBPeripheralErrorEventArgs e) => DisconnectedPeripheral (e.Error, e.Peripheral);
}
readonly AutoResetEvent CentralStateChanged = new AutoResetEvent (false);
private async Task<bool> WaitForCentralState (CBCentralManagerState state, TimeSpan timespan)
{
Console.WriteLine("Waiting for state : " + state);
//TODO; Keep track of time and decrease time-span accordingly
bool timedout = false;
while (!timedout && Central.State != state)
{
timedout = await Task.Run (delegate {
//WaitOne returns false if we timeout
return !CentralStateChanged.WaitOne (timespan);
});
}
//Return true if we made it, amd false if we timedout
return !timedout;
}
private void StartScanning()
{
Console.WriteLine("Start scan requestd!");
if (!IsScanning)
{
//Start!
IsScanning = true;
Console.WriteLine("Kicking scan for peripherals!");
CBUUID[] uuids = null;
Central.ScanForPeripherals (uuids);
}
}
private void StopScanning()
{
Console.WriteLine("Stop scan requested!");
if (IsScanning)
{
//Stop!
IsScanning = false;
Central.StopScan();
}
}
public async Task<bool> SetupTransport ()
{
Console.WriteLine("Setting up transport!");
//Wait for state update...
if (!await WaitForCentralState (CBCentralManagerState.PoweredOn, TimeSpan.FromSeconds (2))) {
//Failed detecting a powered-on BLE interface
Console.WriteLine("Failed detecting usable BLE interface!");
return false;
}
//Kick scanning...
StartScanning();
//Wait for discovery and connection to a valid peripheral, or timeout trying...
await Task.Delay(10000);
return true;
}
#region Internal BLE utility methods
private void DiscoveredPeripheral (CBPeripheral peripheral, NSNumber rssi, NSDictionary advertisementData)
{
Console.WriteLine("DiscoveredPeripheral: " +peripheral.Name);
//If the discovered device's name IS a valid serial number, AND match the serial number that we're intended to establish connection to...
if (peripheral.Name == "MyPeripheralName") {
Console.WriteLine("It's the peripheral we're looking for!");
//Stop scanning...
StopScanning();
//Save reference and connect to it!
CurrentPeripheral = peripheral;
Central.ConnectPeripheral(CurrentPeripheral, new PeripheralConnectionOptions());
}
}
private void ConnectedPeripheral (CBPeripheral peripheral)
{
Console.WriteLine("ConnectedPeripheral: " + peripheral.Name);
//Great -- explore services and charateristics and don't stop until we know that this device is legit!
CurrentPeripheral.DiscoveredService += (object sender, NSErrorEventArgs e) => DiscoveredServices (e.Error);
CurrentPeripheral.DiscoveredCharacteristic += (object sender, CBServiceEventArgs e) => DiscoveredCharacteristics (e.Error, e.Service);
//Kick service discovery!
CurrentPeripheral.DiscoverServices();
}
private void FailedToConnectPeripheral (NSError error, CBPeripheral peripheral)
{
Console.WriteLine("FailedToConnectPeripheral: " + peripheral.Name);
}
private void DisconnectedPeripheral (NSError error, CBPeripheral peripheral)
{
Console.WriteLine("DisconnectedPeripheral: " + peripheral.Name + "(Error = " + error + ")");
}
private void DiscoveredServices (NSError error)
{
Console.WriteLine("DiscoveredService: " + error + " -- " + NSThread.Current.IsMainThread);
if (error != null) {
//No error -- great!
foreach (CBService service in CurrentPeripheral.Services) {
Console.WriteLine ("Discovered service: " + service);
}
}
else
{
//Opps -- failed!
//Disconnect and indicate connection attempt finished
}
}
private void DiscoveredCharacteristics (NSError error, CBService service)
{
Console.WriteLine("DiscoveredCharacteristics for service: " + service);
if (error != null) {
//No error -- great!
foreach (CBCharacteristic characteristic in service.Characteristics) {
Console.WriteLine ("Discovered charateristic: " + characteristic);
}
}
else
{
//Opps -- failed!
//Disconnect and indicate connection attempt finished
}
}
#endregion
}
The problem is that AFTER discovery is done, scanning is stopped, and the app connect to the peripheral and we arrive in the ConnectedPeripheral (CBPeripheral peripheral) function, I get a SIGSEGV crash with the following stack trace;
2015-04-21 23:33:37.205 BLE-test[1487:322866] critical: Stacktrace:
2015-04-21 23:33:37.206 BLE-test[1487:322866] critical: at <unknown> <0xffffffff>
2015-04-21 23:33:37.206 BLE-test[1487:322866] critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
2015-04-21 23:33:37.207 BLE-test[1487:322866] critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
2015-04-21 23:33:37.207 BLE-test[1487:322866] critical: at UIKit.UIApplication.Main (string[],string,string) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
2015-04-21 23:33:37.208 BLE-test[1487:322866] critical: at BLEtest.Application.Main (string[]) [0x00008] in /Users/markus/Xamarin/BLE-test/BLE-test/Main.cs:17
2015-04-21 23:33:37.208 BLE-test[1487:322866] critical: at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Followed by a native stack-trace that I've symbolicated into;
Incident Identifier: DCFCEE70-3D12-4F69-8303-777B2959563D
CrashReporter Key: 25c23a5bf636eb183168b18867096174f0d59b79
Hardware Model: iPhone6,2
Process: BLE-test [1241]
Path: /private/var/mobile/Containers/Bundle/Application/C091012A-B1CB-464B-BDA5-B193C9C26BFC/BLE-test.app/BLE-test
Identifier: com.your-company.BLEtest
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-04-21 22:22:57.387 +0200
Launch Time: 2015-04-21 22:22:56.120 +0200
OS Version: iOS 8.3 (12F70)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000000004b2c0
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000195233270 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001952d116c pthread_kill + 108
2 libsystem_c.dylib 0x00000001951aab14 abort + 108
3 BLE-test 0x00000001001f6878 mono_handle_native_sigsegv (mini-exceptions.c:2360)
4 BLE-test 0x0000000100200554 mono_sigsegv_signal_handler (mini.c:6879)
5 libsystem_platform.dylib 0x00000001952c8958 _sigtramp + 64
6 libobjc.A.dylib 0x0000000194aa5ea8 _class_getVariable + 160
7 libobjc.A.dylib 0x0000000194aa5ea8 _class_getVariable + 160
8 libobjc.A.dylib 0x0000000194a9a934 object_getInstanceVariable + 72
9 BLE-test 0x00000001002b10b0 get_raw_gchandle (runtime.m:304)
10 BLE-test 0x00000001002b1044 get_gchandle (runtime.m:311)
11 BLE-test 0x00000001002b0c6c xamarin_get_gchandle (runtime.m:317)
12 BLE-test 0x00000001002b0bc0 xamarin_get_nsobject_with_type_for_ptr_created (runtime.m:201)
13 BLE-test 0x00000001002b9508 xamarin_trampoline (.monotouch-trampoline-setup-callstack.inc:181)
14 CoreBluetooth 0x0000000182f37198 -[CBPeripheral handleServicesDiscovered:] + 740
15 CoreBluetooth 0x0000000182f34b38 -[CBPeripheral handleMsg:args:] + 280
16 CoreBluetooth 0x0000000182f309d0 -[CBCentralManager xpcConnection:didReceiveMsg:args:] + 160
17 libdispatch.dylib 0x00000001950ed990 _dispatch_call_block_and_release + 20
18 libdispatch.dylib 0x00000001950ed950 _dispatch_client_callout + 12
19 libdispatch.dylib 0x00000001950f80a0 _dispatch_queue_drain + 1444
20 libdispatch.dylib 0x00000001950f0a58 _dispatch_queue_invoke + 128
21 libdispatch.dylib 0x00000001950f1db8 _dispatch_main_queue_callback_4CF + 500
22 CoreFoundation 0x000000018327f7f4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
23 CoreFoundation 0x000000018327d89c __CFRunLoopRun + 1488
24 CoreFoundation 0x00000001831a92d0 CFRunLoopRunSpecific + 392
25 GraphicsServices 0x000000018c9c76f8 GSEventRunModal + 164
26 UIKit 0x0000000187d6efa8 UIApplicationMain + 1484
27 BLE-test 0x00000001000a0b94 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 340
28 BLE-test 0x000000010007e60c UIKit_UIApplication_Main_string___intptr_intptr + 44
29 BLE-test 0x000000010007e5c8 UIKit_UIApplication_Main_string___string_string + 184
30 BLE-test 0x0000000100050110 BLEtest_Application_Main_string__ + 160
31 BLE-test 0x000000010017c06c wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 156
32 BLE-test 0x0000000100202614 mono_jit_runtime_invoke (mini.c:6737)
33 BLE-test 0x000000010024d31c mono_runtime_invoke (object.c:2842)
34 BLE-test 0x00000001002513f8 mono_runtime_exec_main (object.c:4099)
35 BLE-test 0x00000001002afa34 xamarin_main (monotouch-main.m:400)
36 BLE-test 0x00000001001ca924 main + 92
37 libdyld.dylib 0x000000019511aa04 start + 0
Observations and thoughts;
If I remove the delegates to the peripheral after it has been connected, but before I try to discover its services (which means that I'll never see the result of the discovery, but just for test), the DiscoverService routine does NOT result in a crash;
// CurrentPeripheral.DiscoveredService += (object sender, NSErrorEventArgs e) => ...
// CurrentPeripheral.DiscoveredCharacteristic += (object sender, ...
Likewise, I've also tried to keep the delegates above, but remove the actual call to DiscoverServices and that also work without crashing (which is again a stupid test perhaps, but I just wanted to rule-out that something happened when I assigned the delegates in the first place).
I've also read about other peoples experiences with these kind of issues/errors and someone said that it's a GC-issue where an object might be GC'd even though it's still referenced?
Someone also mentioned that things worked in Release-mode but not in debug mode -- so I've tested to run my app in release which ALSO seems to work -- but I don't have any UI so I can't guarantee that is actually works -- but I do know that it does not crash with SIGSEGV...
I'm confused. Please help me understand why Xamarin does not like me. I'm happy to adjust and play by the Xamarin-rules, as long as I understand the constraints and what I can/can't do.
UPPDATE;
I just tried to see if the error was the callback/event-handlers inside the
CBPeripheral, or the actual DiscoverServices method call. So I tried to call
the function and wait 500ms and then see if the services had been discovered in
my peripheral object;
Console.WriteLine ("List of services (before discovery attempt)");
if (CurrentPeripheral.Services != null)
foreach (CBService service in CurrentPeripheral.Services) {
Console.WriteLine ("Service: " + service);
}
CurrentPeripheral.DiscoverServices();
await Task.Delay(500);
Console.WriteLine ("List of services (after discovery attempt)");
if (CurrentPeripheral.Services != null)
foreach (CBService service in CurrentPeripheral.Services) {
Console.WriteLine ("Service: " + service);
}
... and it works! Hence, this means that the call to DiscoverServices works
just fine, but the callbacks does not!
Ok, problem solved. A newbie thing, of course...
When I launched Xamarin Studio and started this project, I played around and looked at the different options, settings, features, menus etc, just to get a grip of the concept as such. One of the things I found was the iOS-build options where one could change the Linker Options. I figured that "Link all assemblies" was a good choice, just to be on the safe side, rather than "Don't link" which was preselected.
Didn't think more about it and continued with the coding.
But when I found the issue raised and explain in this thread, you desperately start to search for anything anywhere, and I started to hunt for GC issues which was what thought was the source of the error. So, reading through the best-practices for Memory management at this link (http://developer.xamarin.com/guides/cross-platform/deployment,_testing,_and_metrics/memory_perf_best_practices/), I found that;
The Link All Assemblies should be used with caution as it may break the application in unexpected ways.
Hence, I changed back to Don't link and now everything works like a charm...
Stuped newbie error? Yes, for sure, but I hope that someone else making the same misstake will find this post and find it useful.
Thanks,
/Markus

Resources