Skip Menu |

This queue is for tickets about the Catalyst-Engine-HTTP-Prefork CPAN distribution.

Report information
The Basics
Id: 44745
Status: open
Priority: 0/
Queue: Catalyst-Engine-HTTP-Prefork

People
Owner: Nobody in particular
Requestors: CATONE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)

Attachments


Looks like currently there are no possibility to re-initialize something in just-forked child. In Net::Server::PreFork there is a child_init_hook, but there are no such in Catalyst::Engine::HTTP::PreFork. Something like attached patch is highly wanted :)
Subject: patch-Prefork-child_init_hook
Download patch-Prefork-child_init_hook
application/octet-stream 410b

Message body not shown because it is not plain text.

What's the use case? If you do something like this won't you be tying your app to a specific engine?
Basis use-case is re-initialization of anything, that must be unique per-child, but is initialized in parent process. Example - rand must be re-seeded after each fork, if you have had to seed it in parent process (during plugin initialization, for example, or it is seeded in some of third-party use'ed modules). About tying to engine type... It's a case that occurs only in perl-forking engines. Engine::CGI, Engine::FCGI are free of such cases, so if init_child is realized in app - it simply will not be used. I'm not sure about Engine::Apache* - never tried it, but it compiles and imports all once in parent process, so probably it needs the same feature. In any case - init_child is not necessary to be called to run application - it should only be used for reinits in forked children. If engine is forking and supports it - it will work clearly, if not forking - it will work the same way, if forking and not supporting - looks like such app shouldn't use it :). It's not that I like such situation, but lack of child_init_hook ( or something similar ) is worser imho.
OK, good point about rand(). I'll add this soon.
Thank you very much.