On Tue, Apr 26, 2005 at 12:34:20PM -0700, Justin Mason wrote:
> I have a hard time figuring out how Net::DNS could be using the same
> counter value, since it just uses rand() to seed it and counts
> consecutively from there by default -- plus there's very few places
> we still use Net::DNS::Resolver::search() or bgsend().

Unless I missed something, no it doesn't.  It sets the initial counter
based on pid (no rand), then increments each time.

$DNS_ID_COUNTER = (($$ >> 10) ^ (($$ << 6) & 0xffff));

My only theory right now is that there are problems once the counter wraps
around the full 16-bits.  The current code may work fine in spamd, whose
children don't tend to have a huge lifespan.  However, in mass-check,
the children (unless --restart is used) live for the entirety of the
run so looping is much more likely.

I'm trying a small patch which basically calls the reinit function when
the counter wraps to 0, as well as using rand when initializing.  This way
it'll get a new random starting point and a new socket occasionally.

-- 
Randomly Generated Tagline:
Wait a minute, Marge.  I saw "Mrs. Doubtfire."  This is a man in drag!
 
                -- Homer Simpson
                   Simpsoncalifragilisticexpiala(annoyed grunt)ocious

Attachment: pgpXuH8PRXKlK.pgp
Description: PGP signature

Reply via email to