Bug 14917 - Xamarin Studio hangs when setting a new breakpoint
Summary: Xamarin Studio hangs when setting a new breakpoint
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: master
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2013-09-22 17:26 UTC by Jonas Sourlier
Modified: 2014-09-09 11:16 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Logfile from Xamarin Studio (10.33 KB, application/octet-stream)
2013-09-23 10:49 UTC, Jonas Sourlier
Details
Logfile from Xamarin Studio (875 bytes, application/octet-stream)
2013-09-23 11:56 UTC, Jonas Sourlier
Details
Logfile from Xamarin Studio (32.01 KB, application/octet-stream)
2013-09-24 07:49 UTC, Jonas Sourlier
Details
Logfile from Xamarin Studio (58.14 KB, application/octet-stream)
2013-09-24 10:28 UTC, Jonas Sourlier
Details
Logfile from Xamarin Studio (59.12 KB, application/octet-stream)
2013-09-25 06:09 UTC, Jonas Sourlier
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jonas Sourlier 2013-09-22 17:26:29 UTC
About every third time I want to set a breakpoint, Xamarin Studio just hangs and the rainbow ball is spinning until I Force Quit it.

This happens on both the iPad 3 and the simulator, on a MacBook Air 2013.

Please tell me what kind of crash dumps or logs you guys need from such a situation.

Thanks!
Comment 1 Jeffrey Stedfast 2013-09-23 07:48:32 UTC
What you can do is open a terminal window and then send the SIGQUIT signal to Xamarin Studio's process. This will tell it to dump a stack trace of the hang to the logs.

To do this, run the following command:

kill -QUIT `ps aux | grep XamarinStudio | grep -v grep | awk '{print $2}'`
Comment 2 Jonas Sourlier 2013-09-23 10:13:00 UTC
Did that, but nothing happens, the process is still there.

I also tried

kill -QUIT 24386

(24386 being the process ID of Xamarin Studio).

Where can I find the dump file?
Comment 3 Jeffrey Stedfast 2013-09-23 10:28:19 UTC
Ah, yea, sorry - the kill -QUIT command doesn't kill the process, it just tells it to dump the threads to the Ide-$TIMESTAMP.log file in ~/Library/Logs/XamarinStudio-4.0

The ~/Library directory is hidden by default, so if you aren't a Unixy person, you can open the log directory in Xamarin Studio's Help menu.
Comment 4 Jonas Sourlier 2013-09-23 10:49:26 UTC
Created attachment 4958 [details]
Logfile from Xamarin Studio

Here you go.
Comment 5 Jonas Sourlier 2013-09-23 11:56:58 UTC
Created attachment 4960 [details]
Logfile from Xamarin Studio

And another one.
Comment 6 Jeffrey Stedfast 2013-09-23 12:33:42 UTC
unfortunately neither one of those log files has the output from your kill -QUIT command
Comment 7 Jonas Sourlier 2013-09-23 13:38:39 UTC
OK. When Xamarin Studio freezes (because of breakpoints or because of whatever), I'm executing your kill -QUIT command on Terminal. The command executes without any ouput on the console.

Then I force quit Xamarin Studio, restart it and go to Help --> Open Log Directory. There are the following files:

Ide.{date...}.log
iOSDesigner.{date...}.log
AndroidTools.{date...}.log
Components.{date...}.log

iOSDesigner and Components files are empty. So I thought you need the Ide files, and I chose the most recent one, which had approximately the timestamp of my "kill -QUIT" command.

Please tell me what files you need.
Comment 8 Jeffrey Stedfast 2013-09-23 15:53:43 UTC
Every time you run Xamarin Studio, it creates a new Ide-timestamp.log file with the date/time of when Xamarin Studio was launched (as well as an "Ide.log" file which is simply an alias for the most recently created log file).

What I need is the Ide-timestamp.log file that corresponds with the Xamarin Studio session that received the kill -QUIT command, which *should* be the one prior to the most recent one (if you launch another Xamarin Studio session in order to get the log directory)
Comment 9 Jonas Sourlier 2013-09-24 07:49:17 UTC
Created attachment 4968 [details]
Logfile from Xamarin Studio

OK this one looks better. You can see the GUI thread being blocked at System.Threading.Monitor.TryEnter when trying to remove a breakpoint.
Comment 10 Jonas Sourlier 2013-09-24 10:28:19 UTC
Created attachment 4971 [details]
Logfile from Xamarin Studio

And another one. Same situation.
Comment 11 Jeffrey Stedfast 2013-09-24 10:37:40 UTC
Thanks Jonas, I'll be looking into this bug today.
Comment 12 Jonas Sourlier 2013-09-24 10:39:10 UTC
Just tell me if you need more, got plenty of them.

Still wondering why I'm the only one experiencing this bug. I reported this
problem a year ago and noone else seems to have it
(https://bugzilla.xamarin.com/show_bug.cgi?id=7143)
Comment 13 Jeffrey Stedfast 2013-09-24 11:41:52 UTC
It's a race condition that I keep thinking I've fixed, and it just always turns out there there's another corner case.

Unfortunately for you, it seems you like to hit *all* of the corner cases ;-)
Comment 14 Jeffrey Stedfast 2013-09-24 15:03:17 UTC
looks like this has already been fixed.

Can you try this build to verify? https://files.xamarin.com/~jeff/XamarinStudio-ca8a8e85e76e76b5084dc87ae11aa54622e06f41.dmg
Comment 15 Jonas Sourlier 2013-09-25 04:15:49 UTC
In a first impression, this looks much better. No Xamarin Studio freezes up to now, and finally breakpoints on background threads are working again!

I'll keep you posted, please don't close the bug yet.
Comment 16 Jonas Sourlier 2013-09-25 06:09:46 UTC
Created attachment 4985 [details]
Logfile from Xamarin Studio

This looks better, I was able to debug my app for nearly two hours without Xamarin Studio freezing, but now I got a new freeze.

This time the freeze happened like this: First, my OpenGL ES 2.0 app froze (on the iPad). I waited for about two minutes, then I pressed the 'Pause debugging' button in Xamarin Studio. This did not do anything, but ten seconds after I pressed the button, the spinning rainbow ball appeared and both Xamarin Studio and my app were frozen.

In the thread dump, it looks like it's still a problem with System.Threading.Monitor.TryEnter.
Comment 17 Jonas Sourlier 2013-09-25 06:10:25 UTC
Please tell me if this is a new bug.
Comment 18 Jeffrey Stedfast 2013-09-25 09:47:22 UTC
the "Detach From Process" menu item was trying to update state while the debugger session lock was held.

There was no reason it had to lock the session lock, though, so that was an easy fix.
Comment 19 Jonas Sourlier 2013-09-25 10:12:01 UTC
So the second freeze is fixed as well? Any chance you could post the .dmg?
Comment 20 Jeffrey Stedfast 2013-09-25 12:10:02 UTC
sure, give this a try: https://files.xamarin.com/~jeff/XamarinStudio-222857fc7316a8d26452cb07507b143017a0eda6.dmg
Comment 21 Val Savvateev 2013-10-04 16:50:11 UTC
Our team is very much affected by this bug. To the point that break points are less preferred way of debugging as compared to excessive tracing.
Comment 22 Jeffrey Stedfast 2013-10-04 17:03:16 UTC
Val: have you tried the dmg linked above? If not, could you try it to see if it solves your problem?

It would be good to know if there are still any remaining deadlock issues...
Comment 23 Marius Ungureanu 2013-11-25 07:06:49 UTC
Is this still an issue?
Comment 24 BB 2014-09-03 06:34:36 UTC
This still happens every day for me with the latest version of (debugging iOS with the simulator)

Xamarin Studio 5.2.1
Xamarin.iOS 7.2.6.28
iOS Simulator 7.1

It started being a problem for me about 8 months ago

This is what tends to happen:

I add a breakpoint, compile and run in the Simulator and it freezes when getting to the breakpoint.

However if I have no breakpoint it runs OK, then if I now add the breakpoint it works and hits the breakpoint fine. So it's the first time it freezes, in case thats any help.

Is it still being investigated?
Any ideas? It's a BIG problem for me.
Comment 25 Jeffrey Stedfast 2014-09-03 09:00:25 UTC
BB: Can you follow the instructions above and provide me with log files of the hang?
Comment 27 BB 2014-09-08 07:49:30 UTC
Hi Jeffrey, OK I have attached the log file after it was happening repeatedly this morning. Once I clear breakpoints, then the code runs OK. So it's having a breakpoint set that was causing Xamarin Studio to crash (no error is reported). Hope that's helpful. let me know if you need more info.
Comment 28 Jeffrey Stedfast 2014-09-08 11:56:59 UTC
BB: Unfortunately there is no crash logged in the log file you provided, perhaps you attached the wrong file?
Comment 29 BB 2014-09-09 04:51:14 UTC
It is the right file, but what was happening in that case was that the iOS app that i was debugging would exit (with no error or anything reported). I re-ran the app quite a few times, so it wasn't Xamarin crashing in this case, it was the app stopping executing (at a point where it could never be crashing). Then when i did Clear all breakpoints, the app ran fine - so it is something to do with having a breakpoint...

Hope that clarifies things.
Comment 30 Jeffrey Stedfast 2014-09-09 11:16:12 UTC
BB: Ah, you are having a completely different problem to this bug. The problem you are having is that the Xamarin.iOS runtime is crashing for some reason.

This bug report is about Xamarin Studio crashing (which has been fixed afaik).

I've submitted a stub bug report here: https://bugzilla.xamarin.com/show_bug.cgi?id=22783

Would you mind filling in the details for the Xamarin.iOS team?

Thanks.