perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: missing stderr during the 2nd pass on startup
Date Fri, 10 Dec 2004 00:04:56 GMT
We discussed this problem on irc, here is some summary and conclusions:

We are talking about the problem on the second pass during the start when:

print STDERR "Foo";

from startup.pl, or any error messages don't get logged.

Philippe M. Chiasson wrote:
> I now fully unserstand the problem,  I am just not sure how we get 
> around fixing
> it.
> 
> First pass, fd2 is connected on the console
> Second pass, server/log.c temporarly closes fd2 and reopens it to /dev/null
> [*]
> OpenLog phase, logs are opened to the right error_log files
> 
> '*' is where we are at the configuration level, so fd2 is open to 
> /dev/null and
> we only need to either:
> 
> 1. dup stderr in, say register_hooks, and change perl's idea of stderr 
> to that duped
>    fd for that short window
> 2. figure out a way to reopen fd2 back to stderr for that short window
> 3. find a way to prevent server/log.c to successfully reopen fd2 to 
> /dev/null

So Paul Querna has convinced me (over IRC / #apr) that it's really our 
problem (not mod_perl's problem, not Apache's problem). And the solutions are:

1) make sure not to run any non-config specific code from config phase 
(going to reshape our test suite)

2) make sure that any errors generated at config phase are return as an 
error string instead of letting perl kill the process.

We will need to re-educate our mp1 users (and ourselves) not to use 
startup.pl and <Perl> sections to run random code.

The most important things to stress in the docs is
----------------------------------------------------------
that the code running in config phase must be invariable - i.e. run 
exactly the same way on 1st and 2nd passes during server start. So if 
there are any problems they will be detected on the first pass when STDERR 
is still open to tty (if there is one). Any other random code should be 
run in post_config phase.
----------------------------------------------------------

Thanks Paul!

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message