Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: mod_perl bug when reading post content with $|?

by Flexx (Pilgrim)
on Aug 30, 2002 at 16:46 UTC ( [id://194168]=note: print w/replies, xml ) Need Help??


in reply to mod_perl bug when reading post content with $|?

UPDATE

Thanks for your anwers, monks!

Now this becomes even stranger... Since you guys think it sounds like a mod_perl bug, too, I installed mod_perl 1.26 and apache 1.3.23 on my SuSE 8.0 i686 Box, so I think I'm fairly up to date now.

Next I ran the client script against http://localhost/perl/tmp/echo_post_data.pl and guess what? It hangs with any content length I tried (1, 10, 10000, 11680, 11681, make your pick). Flip $| to zero, and data is flowing... %-|

It also works with mod_cgi (usually via /cgi-bin/), but it does not work with Apache::PerlRun (/cgi-perl/ on my box)

I'd really appreciate if somebody could crosscheck this on the same / other platforms.

I wonder how this can be a mod_perl bug. Am I the only one to use $| = 1 with mod_perl? 1.21 was out in 1998, how could this have been undiscovered until now?

You could break your CGI apps (or someone else's - HARHAR >;) with just one small change. Or, imagine a common CPAN module would start to set $| nonzero in a new verison... wow... 8|

So long,
Flexx

Replies are listed 'Best First'.
Re: Re: mod_perl bug when reading post content with $|?
by Juerd (Abbot) on Sep 02, 2002 at 18:41 UTC

    Am I the only one to use $| = 1 with mod_perl?

    You might be. Is it ever necessary? You said you want to be as lean as possible, but autoflush ($|) makes scripts slower.

    Or, imagine a common CPAN module would start to set $| nonzero in a new verison...

    That's why one should always use local when setting special variables. Imagine what would happen if one changes $/ without localizing it first. Even not localizing $_ can be problematic. Under mod_perl you should always use local with special variables. (Don't local $ENV{key} as this is buggy: localize the entire hash)

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      Actually, regarding my problem, it doesn't make a difference to localize $|.

      My server now looks like this, but has the same hang

      #!/usr/bin/perl -w use strict; local $| = 1; print "Content-Encoding: iso-8859-1\015\012", "Content-Type: text/plain\015\012", "\015\012"; warn "DEBUG: the content length is $ENV{CONTENT_LENGTH}\n"; my $returncode = read(STDIN, my $post_content, $ENV{CONTENT_LENGTH +}); warn "DEBUG: the read returncode was $returncode\n"; warn "DEBUG: Finished.";

      Stas Bekman has summed up why one would use $| = 1 under mod_perl quite well in mod_perl: Performance Tuning.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://194168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found