Stas Bekman wrote:
[CC'ing the modperl list]

Joey Hess wrote:

Brendan O'Dea wrote:

On Wed, Oct 01, 2003 at 03:30:40PM -0400, Joey Hess wrote:

Do you have any idea why perl 5.8.1 started seeding the RNG as soon as
perl starts? This is very annoying for mooix, all methods run by mood get
the same random seed unless I waste time calling srand at method run
time.


This would appear to be an unexpected side-effect of the hash
randomisation introduced in 5.8.1 (see perldelta).

 $ perl -le 'fork; print rand'                  0.0327924393090768
 0.0327924393090768

Perhaps we should not be setting PL_srand_called when the hash is
seeded.



It occurred to me later that this could perhaps also affect things like mod_perl. I have not checked though.


Indeed it's a problem in mod_perl 1. Thanks for the alert!

It will be fixed in the next release (1.29). Meanwhile setting an explicit seed at the server startup should be used as a temp workaround. e.g.:

env PERL_HASH_SEED=23452 apachectl start

I've just committed this mod_perl 1.0 fix:


Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
retrieving revision 1.146
diff -u -r1.146 mod_perl.c
--- src/modules/perl/mod_perl.c 14 Mar 2003 04:45:52 -0000      1.146
+++ src/modules/perl/mod_perl.c 2 Oct 2003 21:28:44 -0000
@@ -707,6 +707,13 @@
     }
     MP_TRACE_g(fprintf(stderr, "ok\n"));

+#if (PERL_REVISION == 5) && (PERL_VERSION == 8) && (PERL_SUBVERSION == 1) && \
+    (defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT))
+    /* bug in 5.8.1, causing all forked procs to produce the same rand
+     * sequence */
+    PL_srand_called = FALSE;
+#endif
+
     perl_clear_env();
     mod_perl_pass_env(p, cls);
     mod_perl_set_cwd();


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com



Reply via email to