Bug#650806: Weird interaction between time, fork and autoflush

Dominique Dumont dod at debian.org
Mon Jun 11 12:50:43 UTC 2012


Hello

I've looked at this issue on gabrielli. 

The faulty tests times actions done by a forked child process. 

The child process does:

say "A";
flush;
say "B" ;
sleep 5;
flush;

The test verifies that A and B are read with several seconds interval even 
though there's no delay between say A and say B in the child process. (this is 
a kind of buffer bloat test ;-) )

Weird thing: the test may fail even if there's indeed more than 2 seconds 
between receiving A and B (verified with my stopwatch).

After several time measurement manips, it turns out that there's an 
interaction between time() call, fork and autoflush.

The only way to have the test successful is to call time before calling fork 
(i.e. before $child->start). 

One may wonder if this is a proper fix. Anyway, it does prove the autoflush 
stuff, but there's probably another bug lurking down in the buffers.

What do we do now ? 

-- 
https://github.com/dod38fr/config-model/ -o- http://search.cpan.org/~ddumont/
    http://ddumont.wordpress.com/        -o-   irc: dod at irc.debian.org





More information about the pkg-perl-maintainers mailing list