- Home /
Monodev hangs/freeze when pause during debugging
I'm in a bit of a pickle here. I have a fairly complex set of code that has some threading, does some file I/O as well as async network I/O that often freezes, hangs, and ultimately requires Unity Editor (and an attached Monodev) to be terminated and restarted.
I'm fairly experienced with debugging with attaching Monodev, and I know that pressing "pause" will point me to the location in the code where a freeze might occur--for instance a faulty while loop.
I'm puzzled about what might cause Unity Editor to freeze, and when (and already attached) Monodev is paused, it'd freeze Monodev too and never resolve. I've left it running overnight and even over the weekend while I've been out of town. CPU usage remains consistent--about 50% of a single core--and memory usage is unchanged. I have never experienced this problem before, where Monodev itself freezes and becomes unresponsive when attached to Unity and debugging.
And just to be clear, what's happening:
Start Unity, select project and scene
With Monodev and project solution open, attach to Unity process
Start scene
Hit problem, Unity becomes frozen as expected
Go into Monodev, hit "pause", Monodev freezes and becomes unresponsive
Terminate Unity from taskmanager, Monodev loses attachments, returns to normal
Restart Unity, repeat...
I am absolutely sure it's something I'm doing, but I don't know what. The code isn't anything particularly special--a basic listen server aka where the computer is both server and client connected to itself with some reading, processing and exchanging of initial game data--and there is similar code (reading a data file, processing it and exchanging) elsewhere in the project that doesn't produce any problems.
So what might it be? Could a race condition produce this sort of behavior? Something with file I/O? I've tried everything I can think of, so even a general hunch could help point me in the right direction. For what it's worth, I'm running Win 7 64 with Unity 4.5.5 (I know 4.6 is out, haven't gotten around to upgrading yet).
Thanks
Answer by joebob19 · Dec 11, 2014 at 07:31 PM
UPDATE: Upon re-examining things some more, I discovered that CPU usage went to 0, not 50% as I previously stated. This suggests a deadlock, not a race condition based on my research. I have also updated from Unity 4.5.5 to 4.6.1, and was preparing to install and use UnityVS.
However, prior to installing UnityVS, I gave MonoDevelop another shot, and now the freezing/hanging is gone. No other changes than that, in which a freeze could be experienced in a consistent 1 in 3 attempts, and I've now attempted it about 20 times. I don't know what, if anything changed, and it worries me some, but time to move on.