I confirm problem bellow,
the attached c code does not have problem.

Petr

---------- Forwarded message ----------
Date: Sat, 23 Jun 2012 16:23:36 +0300
From: Hleb Valoshka <375...@gmail.com>

It looks like ruby-raindrops hangs on buildd because of issues with ruby1.9.1,
libc and SMP.

This very simple code taken from raindrops maillist [0] will 100% hang on SMP
kfreebsd box:

1000.times do
   pid = fork do
     1 + 1
   end
   Process.waitpid2(pid)
 end

It may be used as a test case :)

It doesn't lock on uniprocessor machine, it doesn't lock under ruby1.8, it
doesn't locks on ordinary FreeBSD. But it locks when run under ruby1.9.1 on SMP
machine with kfreebsd (8.1, 9.0) and glibc.

[0] http://permalink.gmane.org/gmane.comp.lang.ruby.raindrops.general/96
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
                             
              
int main()
{
    int i, r, f, st;
    for (i = 0 ; i < 1000; i++)
    {
        f = fork();
        if (f == 0)
        {
           exit(0);
        } else if (f < 0)
        {
           perror("fork failed");
        } else
        {
           r = waitpid(f, &st, 0);
           if (r != f)
               perror("waitpid");
        }
    }
}

Reply via email to