Thread finished count does not match started count. (Xamarin.Forms) - xamarin.ios

I'm making app with using XF pcl.
on iOS, Thread finished count does not match started count.
I said this because there is a log output and it prints like "Thread started: #55" and "Thread finished: #55" when I debug with iPhone device.
I counted them but started log counts are about 300 and finished log counts are about 100.
Is this can be any clue that my app has some problem that some of started threads were not finished normally?
Or what's the better way to check this issue deeply?
Thanks.

If you're counting the threads correctly, it really seems that you have a leak somewhere. In your situation, I'd turn into profiling tools and the thread window provided by the IDE. Here are the steps you should take:
Both Xamarin Studio (outdated screenshot) and Visual Studio have a Threads window in the debugger pane that can be used to investigate currently running threads in detail. Use them to verify that you actually have an abnormal amount of active threads.
If you have an Enterprise subscription, use the Xamarin Profiler to find out performance bottlenecks in your application. This will very likely help uncover problems in your code as well as in 3rd party code.
Use Xcode Instruments to do the same as above, if you have access to a MAC. Here's how to use them with Xamarin.iOS.
After these steps, you should have at least verified that there is a problem. It's also quite likely that you've found the cause of that problem and fixed it.

Related

"Skipped 75 frames! The application may be doing too much work on its main thread." running empty Compose app

i'm learning how to use jetpack compose in android project.
i just created new project and choose empty compose activity template,
after build finished i run application on Android Emulator.
it successfully run but in Run logs it keep showing info log as
I/Choreographer: Skipped 75 frames! The application may be doing too much work on its main thread.
i'm worried about this issue.
can anyone please help me for this issue i will be very thankful.
log error snapshot
That's nothing to worry about. Emulator performance isn't necessarily representative of real device performance and is often slower due to the overhead of running a second operating system (Android) within your operating system. This is especially true if you don't have the emulator's various hardware acceleration options enabled.
Also, apps run from Studio are debuggable, which disables a number of the optimizations that ART (the Android runtime) would be able to perform on a release app. Plus it needs a bit to load the code into memory and perform just-in-time compilation of the Compose framework.
Bottom line: Don't worry about performance unless you see issues in release mode on a real device.

How to track memory leaks using codeduitests?

I have coded ui tests for standalone application. I think that we have memory leaks.
Does anybody have any ideas how to catch this using coded ui?
I know that we don't have any build-in feature to do this but maybe somebody faced the same problem before...
Doubtful that you can effectively find everything without hand-coding. Very simplified scenario - open and close one form for thousand times(suppose we talk about winforms) and hoping to get outofmemory, already requires cycle to call some automated script thousand times. Not to speak of more sophisticated scenarios - forcing garbage collection after each closing.
Coded ui tests is not the right tool for finding memory leaks.
You need to run profiling tools to identify memory leaks. You can use the visual studio profiler or other tools like ANTs Or .Net memory profiler (http://memprofiler.com/)

How to list threads when debugging in Visual Studio Express 2010

I am trying to track down the reason why my WPF application is not ending cleanly while debugging. By 'cleanly' I mean that all the windows are closed, I can see various messages in the Output window showing that the app has ended but the process is still active and the 'Stop' button in the debugger is still active.
I call the Shutdown() method but something is stopping the application from ending. I am pretty sure it has something to do with the ethernet connection to an IO device but cannot see what I am doing wrong. (When I comment out the call to connect the device the app can exit cleanly)
I was wondering if VSE 2010 can list all active threads as this might give a clue as to what is still 'alive' after the main program ends. Or is there an external tool that might help here?
You should be able to use the Visual Studio Threads window to see which threads are still active. I'm not entirely sure this window is available in the Express edition (the documentation doesn't mention such a limitation), but should you not have it, then you can also use WinDbg to list all threads. WinDbg is part of the debugging tools for Windows. You might need to install the latest version of the Windows SDK to get it.
Use the debugger first. Debug + Break All, Debug + Windows + Threads to see what threads are still running. You can double-click one and use Debug + Windows + Call Stack to see what it is doing. The typical case is a thread you started but forgot to tell to terminate. The Thread.IsBackground property is a way to let the CLR abort a thread automatically for you.
Technically it is possible to have a problem with a device that prevents a process from shutting down. The Threads window would then typically show only one thread with an otherwise impenetrable stack trace. If you use Task Manager, Processes tab, View + Select Columns, tick Handles, then you may see only one handle still in use. The diagnostic then is that you have a lousy device driver on your machine that doesn't properly support I/O cancellation. Which could leave a kernel thread running that doesn't quit, preventing the process from terminating. Very unusual, look for the reasons given in the first paragraph first.

Visual studio 2012 slow unit testing

Running unit tests on VS2012 is lately very slow, when I run them it takes about 12 seconds before they start actually testing.
When I debug it is the same story before I hit the first breakpoint.
I hooked up process monitor and then I found this:
CreateFile \\WORKSTATION*\MAILSLOT\NET\NETLOGON SUCCESS
WriteFile \\WORKSTATION*\MAILSLOT\NET\NETLOGON BAD NETWORK PATH
After that it stays 9 seconds quiet.
CloseFile \\WORKSTATION*\MAILSLOT\NET\NETLOGON SUCCESS
What on earth is going on here? I cannot find any relation between MAILSLOT and Visual Studio at all, but it is going on for about 2 weeks now.
I had the same issue, using VS2012 Update 1. Based on the suggestion in http://social.technet.microsoft.com/Forums/en-US/winserverDS/thread/20eb50e9-3e68-4d29-bcdd-a4fc166b9c00 I disabled NetBios over TCP on my NIC. The tests now start up immediately, and procmon shows the time waiting on \MACHINE*\MAILSLOT\NET\NETLOGON dropped from 5 seconds to about 40 microseconds.
Visual Studio update 1 is now available and apparently addresses some speed issues with unit testing, whether it's related to Mailslot or not I don't know but presumably that's possible if it's in use as a communication mechanism by mstest somehow, from the MSDN forums:
In the upcoming Visual Studio quarterly release (ref http://blogs.msdn.com/b/visualstudioalm/archive/2012/10/08/visual-studio-2012-update-1-ctp.aspx), we have made some performance improvements. In short, we changed the underlying storage mechanism to improve the discovery/run time.
Download links and info here:
http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/26/visual-studio-and-team-foundation-server-2012-update-1-now-available.aspx
This may not be related, but I noticed in some testing I was doing today that my Unit tests seemed to be running slower and slower. By chance I exited/restared Visual Studio and my tests are much faster now. There may be some sort of memory leak or other resource problem in the Unit Test mechanism. I am running update 1.

Troubleshooting a Hanging Java Web App

I have a web application that hangs under high loads. I'm not going to go into the specifics of the code because I really just want some troubleshooting advice and tooling recommendations.
It's a web app, so each request get's a thread. Under a high load test, the app begins to consume all of the cpu, while becoming unresponsive. I suspect that the request threads are hanging in the new code that we are testing. Due to the fact of the cpu consumption, I'm assuming this must be on my app side. My understanding, which could be wrong, is that total cpu consumption indicated my first troubleshooting efforts should be in looking at the code that's consuming those cycles.
What are some tools and/or methods for inspecting which threads are hanging and on what lines of code? Again, I can easily force the app into the problematic behavior.
I've found and been trying out visualvm. Seems like the perfect tool. Still open for suggestions though. I looked at eclipse TPTP and it seems to be end-of-life-ing as well as requiring a more heavy weight deployment.
You can insert logging messages at starting a thread and closing a thread. Then you start the application and inspect the output while penetrating the code.
Another way is to look for memory leaks. If you are sure you haven't one, you can extend the virtual memory of your JVM.
#chad: do you have Database in whole picture...you may want to start by looking what is happening at DB side...you can very well look into DB locks, current sessions etc.

Resources