[Bsd-sharp-list] Mono semaphor help needed

Tom McLaughlin tmclaugh at sdf.lonestar.org
Sun Feb 11 23:00:35 MST 2007


On Sun, 2007-02-11 at 23:39 -0600, R. Tyler Ballance wrote:
> 
> On Feb 11, 2007, at 11:14 PM, Tom McLaughlin wrote:
> 
> > Recently through PRs and pointyhat emails I've seen a few instances
> > where building Mono has gotten stuck because the machine has run out
> > of
> > semaphores to execute mono.  The errors look something like this
> > repeating many times:
> > 
> > 
> > ** (/usr/local/lib/mono/1.0/mcs.exe:36951): CRITICAL **:
> > _wapi_shm_semaphores_init: semget error: 
> > No space left on device. Try deleting some semaphores with ipcs and
> > ipcrm
> > 
> > 
> > The problem is that mono goes into an infinite loop trying to get
> > one
> > instead of failing.  I think it would be preferable to have mono
> > give up
> > and have the C# app crash (maybe with a note why?) instead of just
> > continually looping.  Now the hard part...  Who wants to do the
> > work?
> > I'm not sure where or how to handle this.  Thanks.
> 
> 
> I'm feeling sadistic this week, so here goes.
> 
> 
> How reproducible is this? My FreeBSD boxen are running 6.2-STABLE on
> both of them with fairly GENERIC kernels (with some networking
> additives) is it something you can tell a definite difference between
> CURRENT and STABLE? The obvious short-and-easy solution would be to
> scold users tremendously and then tell them to update the appropriate
> sysctl's in /boot/loader.conf and try their broken app again ;)
> 

It's easily reproduceable.  It's more pronouncable on *BSDs because of
our low default limits.  Here's an ungraceful example.  Adjust total in
the shell script appropriately.

loop.cs:
---
using System;

class Test
{
    public static void Main ()
    {
        int i=1;
        while (i<2)
        {
            string foo = "LOOP!";
        }
    }
}
---

semaphore-test.sh
---
#!/bin/sh
i=1
total=8

while [ $i -lt $total ]; do
    echo Starting: $i
    WAPI=/tmp/semaphor-test-$i
    mkdir $WAPI
    env MONO_SHARED_DIR=$WAPI mono ~/loop.exe&
    i=`expr $i + 1`
done
---

The obvious solution is not to scold users.  It's to fix the app which
is broken.  It's not their fault at all that Mono goes into an infinite
loop while trying to get a semaphore when none are available.  I'd
prefer the C# app crash and then they can be pointed to the pkg-message
which explains the problem.  This has already caused one machine on the
pointyhat cluster to run away.

tom

> 
> It's looking like I've a week of politics ahead of me, so I might be
> able to look into this while unable to do real work, but I would need
> a test case and the environment under which I can reproduce this silly
> stuff.
> 
> 
> 
> 
> 
> 
> Cheers
> 
> 
> R. Tyler Ballance: Custom Mac and Linux Development at bleep.
> consulting 
> contact: tyler at bleepconsulting.com | jabber: tyler at jabber.geekisp.com 
> 

-- 
| tmclaugh at sdf.lonestar.org             tmclaugh at FreeBSD.org |
| FreeBSD                                   http://www.FreeBSD.org |
| BSD#                    http://www.mono-project.com/Mono:FreeBSD |



More information about the Bsd-sharp-list mailing list