Stephen Tyree created ZOOKEEPER-1705:
----------------------------------------

             Summary: Certain implementations of C's rand() function coupled 
with the shuffle in libzookeeper_mt's getaddrs() produce a biased distribution 
of connections.
                 Key: ZOOKEEPER-1705
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1705
             Project: ZooKeeper
          Issue Type: Bug
          Components: c client
            Reporter: Stephen Tyree
            Priority: Minor


Using libzookeeper_mt on an unsupported platform (OpenVMS) with a 5 server 
connection string, the fourth server in the connection string gets selected 
approximately only 6% of the time. This appears to be due to some strange 
properties of the LCG used in OpenVMS's C rand() function. Linux does not 
exhibit this behavior, but I can't speak for Windows, BSD, etc.

It would be prudent, if libzookeeper_mt's behavior is intended to be the same 
on every platform it operates on (not that OpenVMS is one of those platforms), 
to use a PRNG of its own choosing. Integrating a defined PRNG, such as the 
mersenne twister, would give all platforms the same, correct behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to