[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Strange periodic failures of the commandtest case

On Mon, Feb 14, 2011 at 12:32:18PM +0000, Daniel P. Berrange wrote:
> I'm getting periodic failures of the 'commandtest' case where the diff
> is
> > DAEMON:no
> --
> < DAEMON:yes
> For test cases 'test3' through to 'test15', except 'test'4. Tests 1,
> 2, 4, 16, 17, 18 are all unaffected. I can never reproduce it when
> I run just that one test case manually, but the automated builds
> I'm doing hit it > 50% of the time so it is clearly some kind of race
> condition. The line of code that's getting confused is this
>     fprintf(log, "DAEMON:%s\n", getpgrp() == getsid(0) ? "yes" : "no");
> but I'm not clear how this can be going wrong. Ideas ?

Hmm, this seems to occur when you run the build under cron. Under an
interactive shell  getpgrp() != getsid() by default. Under non-interactive
shell, then getpgrp() == getsid() even if we didn't ask to daemonize.
So this approach to detecting whether we're daemonized isn't reliable.

Perhaps the 'commandtest' program itself needs to call setsid()+setpgid()
before running the child processes ?

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]