[Mono-dev] Busy loop in mono

Jonathan Gagnon jonathan.gagnon at croesus.com
Fri Jan 31 21:03:57 UTC 2014


It seems to be related to thread pool threads. I wrote a simple program
that reproduces the problem:

using System.Threading;
using System.Threading.Tasks;

namespace MultiThreadApp
{
class Program
{
static ManualResetEvent evnt = new ManualResetEvent(false);

static void Main(string[] args)
{
for (int i = 0; i < 50; ++i)
 {
Task task = new Task(DoNothing);
task.Start();
 }

evnt.WaitOne();
}

 static void DoNothing()
{
Thread.Sleep(1000);
 }
}
}






On Fri, Jan 31, 2014 at 2:31 PM, Jonathan Gagnon <
jonathan.gagnon at croesus.com> wrote:

> It seems like this bug https://bugzilla.novell.com/show_bug.cgi?id=379602in mono 3.2.5.
>
> I was fixed in mono 2.4 but it seems to have reappeared since then because
> my process is using CPU at doing nothing and I noticed it gets worse if I
> add threads (even if they do nothing). When I use strace on a process
> running with mono 3.2.5, I get a similar output :
>
> futex(0x9ce6520, FUTEX_WAIT, 81061, {0, 999009600}) = -1 ETIMEDOUT
> (Connection timed out)
> time(NULL)                              = 1391196463
> futex(0x9ce6504, FUTEX_WAKE, 1)         = 0
> gettimeofday({1391196463, 363628}, NULL) = 0
> gettimeofday({1391196463, 363707}, NULL) = 0
> time(NULL)                              = 1391196463
> gettimeofday({1391196463, 363848}, NULL) = 0
> time(NULL)                              = 1391196463
> time(NULL)                              = 1391196463
> clock_gettime(CLOCK_REALTIME, {1391196463, 364038031}) = 0
> futex(0x9ce6520, FUTEX_WAIT, 81063, {0, 998961969}) = -1 ETIMEDOUT
> (Connection timed out)
> time(NULL)                              = 1391196464
> futex(0x9ce6504, FUTEX_WAKE, 1)         = 0
> gettimeofday({1391196464, 363500}, NULL) = 0
> gettimeofday({1391196464, 363597}, NULL) = 0
> time(NULL)                              = 1391196464
> gettimeofday({1391196464, 363713}, NULL) = 0
> time(NULL)                              = 1391196464
> time(NULL)                              = 1391196464
> clock_gettime(CLOCK_REALTIME, {1391196464, 363903927}) = 0
>
> The same process doesn't use any cpu time when running on .NET.
>
> Any idea what could cause this problem.  Has anyone else noticed this
> problem?
>
> Jonathan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140131/1d494195/attachment.html>


More information about the Mono-devel-list mailing list