[Mono-bugs] [Bug 682256] When i run my service using mono-service2 and after i stop the service cpu usage is increased to > 100

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jun 4 10:23:15 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=682256

https://bugzilla.novell.com/show_bug.cgi?id=682256#c2


Vyacheslav Gerasymenko <vyacheslav.com at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vyacheslav.com at gmail.com

--- Comment #2 from Vyacheslav Gerasymenko <vyacheslav.com at gmail.com> 2011-06-04 14:23:13 UTC ---
This bug is reproducible on Mac OS X 10.6 with latest Mono 2.10.2. After
executing next command:

launchctl stop your.deamon.id.string

CPU usage of daemon process rises to 100% and after 20 seconds (default
timeout) it is killed by launchd. This bug is mentioned on several forums, for
example:

http://go-mono.com/forums/#nabble-td3341154
http://stackoverflow.com/questions/3290247/mono-service2-loops-on-exit-running-on-mac-osx-10-5

For now I use next workaround:

protected override void OnStop()
{
  Thread thread = new Thread(CheckExit);
  thread.IsBackground = true;
  thread.Start();
}

private static void CheckExit()
{
  System.Threading.Thread.Sleep(1000);
  Process process = Process.GetCurrentProcess();
  process.Kill();
}

Which simply waits for 1 second after finishing processing of stop signal and
kills itself - very bad workaround, but it avoids 20 seconds wasting of 100%
CPU resources.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list