Crash reporting with Flurry and Monotouch - xamarin.ios

I'm using Flurry Analytics and Xamarin.iOS to write an iOS application. I use bindings from here (Flurry SDK 4.2.3). In FinishedLaunching() method override I call:
Flurry.SetCrashReportingEnabled(true);
Flurry.StartSession(FlurryAPIKey);
Everything compiles and launches successfully.
After real data appears in Flurry dashboard I see many errors with the same call stack:
0 Fines 0x0049e500 -[FlurryPLCrashReporterConfig symbolicationStrategy] + 4334767
1 Fines 0x0049e61c -[FlurryPLCrashReporterConfig symbolicationStrategy] + 4335051
2 Fines 0x0049e908 -[FlurryPLCrashReporterConfig symbolicationStrategy] + 4335799
...
30 Fines 0x00685c53 -[FlurryPLCrashReporterConfig symbolicationStrategy] + 6331394
31 libsystem_pthread.dylib 0x38a90919 <redacted> + 140
32 libsystem_pthread.dylib 0x38a9088b __pthread_start + 102
33 libsystem_pthread.dylib 0x38a8eaa4 _thread_start + 8
What does this call stack mean? And what is the correct way to track all unhandled exceptions with Monotouch and Flurry?

From flurry FAQ:
My strack traces are de-symbolicated/obfuscated.
For iOS applications we have partnered with Plausible Labs to create an innovative technology that re-symbolicates most of the stack trace in the application itself so you do not need to provide a desym file to use the service. We also provide ways to upload your desym file to improve your stack trace detail and to support Android applications. On the stack trace detail page, there is the option to upload either the dsym file (iOS) or the Proguard mapping file (Android). Once you upload the file, we’ll try and symbolicate the stack traces for you.
dsym file means the file with extension .dSYM it should be in the folder with your .ipa build. Also dSYM file is uniq for every new build don't forget to save somewhere the dsym file.

Related

Could not get HttpClient cache - No ThreadContext available for thread id=1

I'm working on upgrading our service to use 3.63.0 (upgrading from 3.57.0) and I've noticed the following warning (with stack trace) shows up in the logs that wasn't there on the previous version:
2022-02-18 14:03:41.038 WARN 1088 --- [ main] c.s.c.s.c.c.AbstractHttpClientCache : Could not get HttpClient cache.
com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextAccessException: No ThreadContext available for thread id=1.
at com.sap.cloud.sdk.cloudplatform.thread.ThreadLocalThreadContextFacade.lambda$tryGetCurrentContext$0(ThreadLocalThreadContextFacade.java:39) ~[cloudplatform-core-3.63.0.jar:na]
at io.vavr.Value.toTry(Value.java:1414) ~[vavr-0.10.4.jar:na]
at com.sap.cloud.sdk.cloudplatform.thread.ThreadLocalThreadContextFacade.tryGetCurrentContext(ThreadLocalThreadContextFacade.java:37) ~[cloudplatform-core-3.63.0.jar:na]
at io.vavr.control.Try.flatMapTry(Try.java:490) ~[vavr-0.10.4.jar:na]
at io.vavr.control.Try.flatMap(Try.java:472) ~[vavr-0.10.4.jar:na]
at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextAccessor.tryGetCurrentContext(ThreadContextAccessor.java:84) ~[cloudplatform-core-3.63.0.jar:na]
at com.sap.cloud.sdk.cloudplatform.connectivity.RequestScopedHttpClientCache.getCache(RequestScopedHttpClientCache.java:28) ~[cloudplatform-connectivity-3.63.0.jar:na]
at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractHttpClientCache.tryGetOrCreateHttpClient(AbstractHttpClientCache.java:78) ~[cloudplatform-connectivity-3.63.0.jar:na]
at com.sap.cloud.sdk.cloudplatform.connectivity.AbstractHttpClientCache.tryGetHttpClient(AbstractHttpClientCache.java:46) ~[cloudplatform-connectivity-3.63.0.jar:na]
at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.tryGetHttpClient(HttpClientAccessor.java:153) ~[cloudplatform-connectivity-3.63.0.jar:na]
at com.sap.cloud.sdk.cloudplatform.connectivity.HttpClientAccessor.getHttpClient(HttpClientAccessor.java:131) ~[cloudplatform-connectivity-3.63.0.jar:na]
at com.octanner.mca.service.MarketingCloudApiContactService.uploadContacts(MarketingCloudApiContactService.java:138) ~[classes/:na]
...
This happens when the following calls are made...
Using the lower level API
HttpClient httpClient = HttpClientAccessor.getHttpClient(destination); // warning happens here
ODataRequestResultMultipartGeneric batchResult = requestBatch.execute(httpClient);
Using the higher level API
service
.getAllContactOriginData()
.withQueryParameter("$expand", "AdditionalIDs")
.top(size)
.filter(filter)
.executeRequest(destination)); // warning happens here
Even though this warning shows up in the logs the service requests do continue to work as expected. It's just a little concerning to see this and I'm wondering if maybe I have something misconfigured. I reviewed all of the java docs and the troubleshooting page and didn't see anything out of the ordinary other than how I am fetching my destination, but even using the DestinationAccessor didn't seem to make a difference. Also, I'm not doing any asynchronous or multi-tenant processing.
Any help you or guidance you can give on this would be appreciated!
Cheers!
Such an issue is often the result of missing Spring Boot annotations - especially in synchronous executions.
Please refer to our documentation to learn more about the SAP Cloud SDK Spring Boot integration.
Edit Feb. 28th 2022
It is safe to ignore the logged warning if your application does not need any of the SAP Cloud SDK's multitenancy features.
Error Cause
The SAP Cloud SDK for Java recently (in version 3.63.0) introduced a change to the thread propagation behavior of the HttpClientCache.
With that change, we also adapted the logging in case the propagation didn't work as expected - this is often caused by not using the ThreadContextExecutor for wrapping asynchronous operations.
This is the reason for logs like the one described by the issue author.
Planned Mitigation
In the meanwhile, we realized that these WARN logs are causing confusion on the consumer side.
We are working on improving the situation by degrading the log level to INFO for the message and to DEBUG for the exception.

Where are the logs and memory dumps of Azure Function crashes?

Sometimes my azure function fails and I have no record of what happened. Function just stops executing.
I think there is major error like StackOverflow, but since there is no record of it I can't be sure.
I created a simple azure function to emulate simple stack overflow:
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log, ExecutionContext executionContext)
{
RunStackOverflow();
}
private static void RunStackOverflow()
{
RunStackOverflow();
}
When I call this using http trigger, I get 502 error in browser, but there is nothing in logs about this failure. Screenshot: https://www.screencast.com/t/ymWoBey4KX
StackOverflow is just one of the exceptions that can't be caught and can result in function crash. Locally when I run the function in emulator I see stack overflow error in cmd window where function starts. Screenshot: https://www.screencast.com/t/f85U2KmdEBBt
In Azure portal I checked:
function invocations (screenshot: https://www.screencast.com/t/ufB1Zfthz)
function logs (screenshot: https://www.screencast.com/t/A2ix6yuSuJkE)
app insights (screenshot: https://www.screencast.com/t/NyRFLDK23p)
But there is no log entry of this crash anywhere.
I contacted Azure support, but they are not very helpful so far.
Update on Apr 12
Using KUDU I can create memory dump using command like this
c:\devtools\sysinternals\procdump -e -ma -w 12268
This shows me all stack traces for all threads and this is what I need, but only when first chance exception occurs.
The command to trigger memory dump when there is such exception is:
c:\devtools\sysinternals\procdump -accepteula -e -g -ma 8844
but when I run it and then trigger StackOverflow exception here is what is written out to command line:
[11:37:36] Exception: E0434352.CLR
[11:37:36] Exception: C00000FD.STACK_OVERFLOW <--- Stack overflow
[11:37:37] The process has exited.
[11:37:37] Dump count not reached.
Unfortunately there is no memory dump created, so I can't see a stack trace that caused stack overflow.
I also tried:
c:\devtools\sysinternals\procdump -accepteula -e -g -ma -t 13244
-t option triggers memory dump when process exits.
This one actually records a memory dump when Function crashes. Unfortunately this dump doesn't include stack trace for StackOverflow. It seems to get dumped after the thread already crashed.
Update on Apr 21
There are multiple ways to host Azure functions described here:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale
The most common and default way is Consumption plan. After a bunch of trial-and-errors I found that Diagnostics Tools (https://www.screencast.com/t/DyT6Jpuqm2uo) which can be used to detect and analyze crashes are not available with Consumption plan. On the other hand they are available with App Service (Basic and plus) and other plans. Azure support told me that currently there are no plans to add it to Consumption plan.
So for now I made a new Azure Function hosted using App Service Plan and I was able to use Diagnostic tools to record crash dumps. After fixing the issues I plan to go back to Consumption plan, so it is a bit of a hack, but it does work for now.
Currently, this level of logs are not supported very well.
You can use Diagnose and solve problems option from azure portal by following this link, but note that some features(like Application Crashes) in this option are still in development.
Steps:
1.In azure portal -> your function app -> click Diagnose and solve problems -> then click the Function App Down or Reporting Errors link. Here is the screenshot:
2.Wait for a while before the report completes generating -> then check the items starts with red exclamation mark(by using your code, the error details are in the Web App Restarted item. But it just shows a common message like app crashes, not stackoverflow):

kentico 9 cmsdesk system error after admin login

This is a fun one. Just moved my build to the dev environment. I'm getting a system error when trying to access the CMS Desk. I can't see the event log to trouble shoot. How i can go about finding possible issues. I had admin access to the DEV VM, but not the SQL box.
I'm currently on hot fix 30, and my local dev is fine.
I've noticed that the Kentico CMS Health Monitor and Scheduler services didn't start. Manualy starting these gives an error.
When i attempted to login in from the VM, i get this error.
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'CMSAdminControls_Basic_OrderByControl' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a8d48e58\742913f6\assembly\dl3\864636c6\8ed0e2be_5525d201\CMSApp.DLL' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a8d48e58\742913f6\App_Web_orderbycontrol.ascx.cffe6b5c.9lvruqx-.dll'
Source Error:
Line 87:
Line 88:
Line 89:
Line 91:
Source File: c:\inetpub\wwwroot\Kentico9\CMS\CMSAdminControls\UI\UniGrid\Controls\AdvancedExport.ascx Line: 89
Try to clean (delete) content from that temporary folder.
Looks like Kentico was setup as a Web Site, rather than a Web Application. Just as easy to nuke, and reinstall.

KeyNotFoundException with RavenDb

Just installed RavenDb Build-3528 as a Website in IIS.
RavenDb is running just fine, management studio is reachable on http://localhost:8080, created databases etc, so far no problem.
However when I start my MVC 5 application (with regular MVC Controllers and WebApi Controllers) the application crashes on startup with the json message:
{
message: "An error has occurred.",
exceptionMessage: "The given key was not present in the dictionary.",
exceptionType: "System.Collections.Generic.KeyNotFoundException",
stackTrace: " at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key) at Raven.Database.Server.Controllers.RavenBaseApiController.InnerInitialization(HttpControllerContext controllerContext) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Controllers\RavenBaseApiController.cs:line 101 at Raven.Database.Server.Controllers.RavenDbApiController.InnerInitialization(HttpControllerContext controllerContext) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Controllers\RavenDbApiController.cs:line 112 at Raven.Database.Server.Controllers.RavenDbApiController.<ExecuteAsync>d__3a.MoveNext() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\Controllers\RavenDbApiController.cs:line 54 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
Funny thing is: before installing RavenDb as Website in IIS we used RavenDb 2.5 as embedded server in our MVC application and worked just fine.
In the Windows Event Manager I can't find any useful information.
Anyone an idea what's going on?
Hah!
It turns out that if you comment out the following line in WebApiConfig.cs that error disappears:
// Web API routes
config.MapHttpAttributeRoutes(); // <--- Offending line
Apparently RavenDB calls MapHttpAttributeRoutes() as well so there's a conflict...
Of course, commenting out that line means that the WebApi routes no longer work, throwing an Multiple actions were found that match the request error.
UPDATE
On my solution there is a project with Unit Tests that requires Raven.Database.dll because it uses the EmbeddableDocumentStore to run tests in memory.
This Raven.Database.dll ends up on the bin folder of the MVC/WebApi project. As soon as you delete it, the website works. So it really is the EmbeddableDocumentStore wrecking havoc with WebApi.
In short, make sure you have no references to Raven.Database.dll in your WebApi projects, and that the dll doesn't end up in the bin of your WebApi project either (by setting Copy to Local = false, for instance).
UPDATE 2
It turns out that somehow my main project had a reference to the test project, that's why Raven.Database.dll ended up in my main project's bin folder. Just removing that unnecessary reference does the trick, no neet to set Copy to Local = false.

Getting Azure Logs from role process

I've configured the Azure Diagnostics so that the logs get uploaded to a storage table. I'm using Trace.TraceXxx from my code and all works well.
Now I'm trying to add tracing from the Role OnStart() and OnStop() methods. I know that the tracing works as I see the lines in the Debug window when running in the emulator. But from the cloud deployment, it seems that these trace lines never get uploaded to the table. My guess is that it is somewhat related to TraceSources, as the only trace lines I've in the table come from the w3wp.exe source... Any hint ?
Thanks
Like you said you can add the trace listener using the WaIISHost.exe.config, but besides that you can also add the trace listener in code (you'll need a reference to Microsoft.WindowsAzure.Diagnostics.dll):
public class WebRole : RoleEntryPoint
{
public override void Run()
{
var listener = new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener();
Trace.Listeners.Add(listener);
...
}
}
Another way of setting up diagnostics is through the configuration file. If you created a VS solution recently, it will automatically create the diagnostics plug-in and configuration for the trace listener. With the config file (diagnostics.wadcfg) there is no code that needs to be written for the different data sources. Here is a link where you can get started and a sample file:
http://msdn.microsoft.com/en-us/library/gg604918.aspx
You cannot include custom performance counters right now and you need to make sure that you don’t try to allocate more than 4GB of buffer to anything (you can leave at 0), or it tends to fail.
Note, the time interval format (e.g PT1M). That is a serialization format, so PTXM is X minutes, while PTXS is X in seconds. You need to mark this as content and copy always in Visual Studio (place at root of project) so it gets packaged.
And here is a link to the three ways to setup diagnostics
http://msdn.microsoft.com/en-us/library/windowsazure/hh411541.aspx
Ranjith
http://www.opstera.com

Resources