Received: (qmail 61413 invoked by uid 501); 15 Mar 2002 00:21:43 -0000 Message-Id: <20020315002142.61410.qmail@apache.org> Date: 15 Mar 2002 00:21:42 -0000 From: Jeroen Boomgaardt Reply-To: jeroen@swissclue.com To: submit@bugz.apache.org Subject: rnd map type balancing broken X-Send-Pr-Version: 3.110 >Number: 10185 >Category: mod_rewrite >Synopsis: rnd map type balancing broken >Confidential: no >Severity: serious >Priority: medium >Responsible: apache >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Mar 14 16:30:00 PST 2002 >Closed-Date: Sat Mar 16 15:47:09 PST 2002 >Last-Modified: Sat Mar 16 15:47:09 PST 2002 >Originator: jeroen@swissclue.com >Release: 1.3.23 >Organization: >Environment: Linux system1 2.4.9-31smp #1 SMP Tue Feb 26 06:55:00 EST 2002 i686 unknown >Description: Between 1.3.22 and 1.3.23, a change was made to one line in mod_rewrite.c: < return ((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l; --- > return (int)((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l; This breaks the random balancing between the value parts in a rnd type map, at least on RedHat 7.2: it always selects the first value part. This map type is normally used for load balancing through Apache. If such a setup is tried with Apache 1.3.23, all load will be sent to the first system. >How-To-Repeat: Try to use a rnd type map. >Fix: If the above change is reverted, i.e. remove the (int) that was added, the rnd map type will function as expected again. >Release-Note: >Audit-Trail: State-Changed-From-To: open-closed State-Changed-By: wrowe State-Changed-When: Sat Mar 16 15:47:09 PST 2002 State-Changed-Why: Bingo. You hit the nail on the head, I've wrapped the entire expression before casting to (int) for the correct return type. This problem should be resolved in 1.3.24 - thank you for the report and identifying the solution!!! >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]