[Catalyst] [PATCH] [RFC] Seed the RNG in Catalyst::Engine::FastCGI

Jonathan Rockway jon at jrock.us
Tue Feb 3 17:45:07 GMT 2009


* On Mon, Feb 02 2009, Andrew Rodland wrote:
> Due to the way FastCGI does its business, when running as an "external"
> FastCGI, the perl interpreter and the Catalyst app are initialized before the
> FCGI process manager does its forking. Since modern versions of Perl seed
> rand() "eagerly" on startup, this leads to all of the FastCGI children
> inheriting the same RNG state, and very nonrandom behavior (such as CAPTCHAs
> that appear to get "stuck").
>
> I've thought over the problem and decided that the only appropriate place for
> a fix is in Engine::FastCGI. A srand anyplace else (including the app code)
> would run either too early (not solving the "shared state" problem) or too
> late (re-seeding on every request is Bad.)

Wait, is there a reason why we can't do this in FCGI::ProcManager
instead?  This is something that affects everyone using FCGI, not just
Catalyst.

--
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list