Stas Bekman wrote:

Steve Hay wrote:
[...]

This version gets SMOKE running, but it doesn't seem to be able to keep running.

I have a 1.99_10 build tree in which "nmake test" runs with all tests successful every time, but when I try "perl t/SMOKE" with your patch below, I find that one of the tests has an error and causes everything to stop.

I've tried it three times now. Each time I had it fail on a different test (modperl\cookie, modperl\endav, modperl\post_utf8), but every time I get this message written into t/logs/error_log:

Failed to dup STDIN: Permission denied.




That sounds bad. What it tries to do is:

open my $oldout, ">&STDIN" or die "Can't dup STDIN: $!";

though using the C API:

modperl_in.c:102

status = Perl_do_open(aTHX_ handle_save, ">&STDIN", 8, FALSE, O_RDONLY,
0, Nullfp);
if (status == 0) {
Perl_croak(aTHX_ "Failed to dup STDIN: %_", get_sv("!", TRUE));
}


Hmm, looks like I can't count. Does this help:

Index: src/modules/perl/modperl_io.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io.c,v
retrieving revision 1.11
diff -u -r1.11 modperl_io.c
--- src/modules/perl/modperl_io.c 24 Aug 2003 19:37:29 -0000 1.11
+++ src/modules/perl/modperl_io.c 1 Oct 2003 17:30:27 -0000
@@ -99,7 +99,7 @@
MP_TRACE_o(MP_FUNC, "start");


/* open my $oldout, ">&STDIN" or die "Can't dup STDIN: $!"; */
- status = Perl_do_open(aTHX_ handle_save, ">&STDIN", 8, FALSE, O_RDONLY,
+ status = Perl_do_open(aTHX_ handle_save, ">&STDIN", 7, FALSE, O_RDONLY,
0, Nullfp);
if (status == 0) {
Perl_croak(aTHX_ "Failed to dup STDIN: %_", get_sv("!", TRUE));



Sadly, no :-(


I should commit that anyway.

BTW, Why is it ">&STDIN"? I would have thought "<&STDIN" makes more sense. Anyway, I tried rebuilding everything with "<&STDIN" and it made no difference - testsuite OK, smoke NOT OK.




I applied your patch above and Randy's IPC::Run3 patch to a fresh 1.99_10, built it all, and I still get the same result: the testsuite passes all tests OK, but t/SMOKE fails on a seemingly random test of it's choice (I had modperl\env this time) with the same "Failed to dup STDIN: Permission denied." error in the error_log.


bugger!

This is the only message in the log after the server has started up, and it doesn't appear until the test fails. I'm using IPC::Run3 0.009 on Perl 5.8.1 / Apache 2.0.47.




Can you reproduce this problem outside t/SMOKE? You should be able to by doing:

t/TEST -start
t/TEST -run modperl\cookie
t/TEST -stop

since that's what t/SMOKE does



No - I tried that half a dozen or more times, and it worked fine every time, with or without your patch.


The last failure that I had (with your patch in place) was on only the second test that it tried, so I tried running them both like this:

   perl t/TEST -start
   perl t/TEST filter\out_str_req_mix
   perl t/TEST modperl\env
   perl t/TEST -stop

to try and reproduce what the SMOKE had actually done, but that worked too!


So is it possible that the bug comes from perl? This randomness is troubling. (Did you have some magnetic storms in England recently? ;)

Funny you should mention that - the weather has just taken a turn for the worse!




can you write a plain perl script that does:

open my $oldout, ">&STDIN" or die "Can't dup STDIN: $!";
then restores it and then re-opens again? and try to run it several times (outside modperl)?

Is this the sort of thing you had in mind?:-


=====
use strict;
use warnings;
for (1 .. 100) {
   open my $oldin, "<&STDIN" or die "Can't dup STDIN: $!";
   close STDIN;
   printf "Dupped STDIN as fileno %d\n", fileno $oldin;
   open STDIN, "<&", $oldin or die "Can't restore STDIN: $!";
   close $oldin;
   printf "Restored STDIN as fileno %d\n", fileno STDIN;
}
=====

I've called the variable $oldin rather than $oldout, and used "<" rather than ">". (Otherwise Perl warns "Filehandle STDIN reopened as STDIN only for output" when restoring STDIN.)

The above runs fine using the same Perl (5.8.1) that I'm running mod_perl-1.99_10 with. (It also works OK with ">" instead of "<" aside from the warnings from Perl.)

- Steve


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to