http://qs321.pair.com?node_id=81981


in reply to Re: Everything gets output twice
in thread Everything gets output twice

Absolutely no forks, and I put that random number check in just to make sure of that (in case Apache was forking twice or something). In case of a fork the random number generator would be called twice, and would return two different random numebrs.

It really is looking like something is copying STDERR and returning it about a second later.

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
(tye)Re: Everything gets output twice
by tye (Sage) on May 21, 2001 at 21:25 UTC

    Actually, the most common problem with doubled output and fork is when the stdio buffers are copied by the fork. In that case, you'd get the same number as the call to rand would have happened before the fork.

    Also, fork duplicates the whole process including the current seed used by rand, so even if the fork happened before the call to rand, you'd get the same number in both processes unless you managed to get Perl's implicit use of srand to happen after the fork.

            - tye (but my friends call me "Tye")