go ahead... be a heretic | |
PerlMonks |
mod_perl bug when reading post content with $|?by Flexx (Pilgrim) |
on Aug 30, 2002 at 13:43 UTC ( [id://194104]=perlquestion: print w/replies, xml ) | Need Help?? |
Flexx has asked for the wisdom of the Perl Monks concerning the following question:
Brothers and Sisters, fellow Monks! After four days of meditating about this, I step before you, humbly asking for some insight. I really don't know if my problem is reproducable on other setups, maybe I'm just an unlucky guy. Note also that I (unfortunately) can't change my setup, since this is beyond my control. PerlMonks is great. If you want to ask a qualified question, you have to sit down and write a small script to reproduce your problem, and that quite often leads to a solution "all by itself"... That's what happened to me, with my current problem. I didn't see that what I am about to describe was related to $| before I stripped down my server script to present only the relevant parts here... Usually I'd bang my head onto my keyboard now, fix the real thing, and exhale... But this time I'm courious, since I found a workaround but no explanation for my problem, so I modified my post and put it on here... I was wondering whether the SOPW was the right place, or if this might be enough for some meditation -- to be on the secure side, I chose the former. Any yes, I know this is not the place to tell the story of a lifetime, but that's me... ;) But first, let me describe my configuration:
Server: Apache 1.3.12, mod_perl 1.21, Apache::Registry 2.01 on IBM AIX 4.3 In my httpd.conf you'll find:
Now put the following script on the server (I named it echo_post_data.pl):
Then put the following script on your client (I named it client_info_postdata.pl)
Now do perl client_info_postdata.pl http://pacman.host.magwien.gv.at:8080/cgi-registry/echo_post_data.pl 11680 + Everything will work fine:
Then say perl client_info_postdata.pl http://pacman.host.magwien.gv.at:8080/cgi-registry/echo_post_data.pl 11681 + If it works fine, do it a few times. You should see:
On my setup this will hang until it times out:
Apache's errlog log will show (after the timeout):
Note the one-byte difference? Seemingly something chomped (?) the last byte of my post data!! Who was it? Come out, Bastard! Now for the strange part of this: If I run the same script against /cgi-bin/ (mod_cgi instead of Apache::Registry), it works fine. When I comment out $| = 1 it works fine, too. When I don't print the final "\015\012" it works too, but then I get:
And, much to my surprise it appears to work once whenever Apache::StatINC reloads some of my libraries I load on that server. AFAIK I don't do anything I should better not do in mod_perl, or do I? Or, did I discover something here? Is this a known bug in mod_perl 1.21 or Apache::Registry 2.01 I haven't heard know about? It seems that I can simply leave $| off to solve my problem for now, but I'd really want my hot pipes back! I already tried chunked reading, BTW, using
instead of reading in everything at once, but that didn't help. The script hung just the same (It does 2 loops than hangs in the third. Any ideas? Next thing I am going to do, is to look inside Apache::Registry, maybe I can find an explanation for this. I guess CORE::read is overloaded, maybe there's a glitch somewhere. So long, FlexxAdditional Info perl -v says:
Back to
Seekers of Perl Wisdom
|
|