You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Bill Marrs <bi...@apocalypse.org> on 2003/07/21 13:49:39 UTC

Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

>I can measure it myself if you can provide me with URLs to your resources
>and identify them in terms of which one is mod_CGI and which is mod_perl.

This is the mod_cgi one that works fine, no errors:
http://shevek.kenyonhill.com/cgi/test.pl

This is the mod_perl one (same script) that generates the "20014:Error" in 
the error_log.  Also, the page doesn't display correctly (it seems to erase 
itself):

http://shevek.kenyonhill.com/perl/test.pl

This is the contents of test.pl:

---
#!/usr/bin/perl
$|=1;
print "Content-Type: text/html\n\n";
print "hello world<P>";
# This line causes the error
print "";
---

Let me know if you need anything more.


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Stas Bekman <st...@stason.org>.
Bill Marrs wrote:
> 
>> Please report to the list the bug id so we can document this issue for 
>> those who have the same problem with older httpds. Thanks.
> 
> 
> OK, I've posted it.
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22259
> 
> Thanks for the fix!

For the archives: This bug has been fixed in the current httpd-2.0 cvs, and 
will be also in the soon to be released 2.0.48.

__________________________________________________________________
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


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Bill Marrs <bi...@apocalypse.org>.
>Please report to the list the bug id so we can document this issue for 
>those who have the same problem with older httpds. Thanks.

OK, I've posted it.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22259

Thanks for the fix!

-bill


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Stas Bekman <st...@stason.org>.
Bill Marrs wrote:
> 
>> Try this patch:
>> [...]
>>
>> Feel free to submit this bug report and the fix to httpd-dev. Please 
>> let me know if you do that, so I won't duplicate it. But I'd prefer 
>> that you do it so you can make sure that it gets fixed in the next 
>> release, since you need it working.
> 
> 
> I've just verified that your patch fixes my problem.

Great!

> I've never submitted a but report and fix to httpd-dev, but I'm willing 
> to do it.
> 
> How do I do it?

Open a bugzilla account and add a new bug report:
http://httpd.apache.org/bug_report.html

Please report to the list the bug id so we can document this issue for those 
who have the same problem with older httpds. Thanks.

__________________________________________________________________
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


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Bill Marrs <bi...@apocalypse.org>.
>Try this patch:
>[...]
>
>Feel free to submit this bug report and the fix to httpd-dev. Please let 
>me know if you do that, so I won't duplicate it. But I'd prefer that you 
>do it so you can make sure that it gets fixed in the next release, since 
>you need it working.

I've just verified that your patch fixes my problem.

I've never submitted a but report and fix to httpd-dev, but I'm willing to 
do it.

How do I do it?

-bill



Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Slava Bizyayev <sb...@outlook.net>.
> Well, the problem is that I get this error in my error_log:
>
> [Mon Jul 21 14:18:55 2003] [error] 4297: ModPerl::RegistryBB: 20014:Error
> string not specified yet at /var/www/perl/test.pl line 6.
>
> Also, more important, the script seems to be terminating and/or any output
> following the 'print ""' is not sent to the client as far as I can tell.

This is another story! You have a problem with ModPerl::RegistryBB. HTTP log
can't help if ModPerl::RegistryBB aborts at that point. From my point of
view it is supposed to be a warning (or debug/warning) instead of the error
in ModPerl::RegistryBB, because it could be necessary sometimes to flush
empty string (for example, to overwrite the default chunking behavior of
core Apache).

Unfortunately, I can't look into the sources of Apache-2 now.

Can somebody help to patch this problem on Bill's machine first in order to
let us to go ahead with this research?

Thanks,
Slava


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Stas Bekman <st...@stason.org>.
Bill Marrs wrote:
[...]
>> You would probably wish to append your script with
>> additional output after the empty string? Something like:
>>
>> #!/usr/bin/perl
>> $|=1;
>> print "Content-Type: text/html\n\n";
>> print "hello world<P>";
>> # This line causes the error (?)
>> print "";
>> print "hello again<P>";
>> ---
> 
> 
> When I do this, the mod_perl variant of the script fails to print "hello 
> again<P>".
> 
> mod_cgi prints everything just fine and gets no errors.
> 
> I changed my test script to print a bunch of `date`'s
> http://shevek.kenyonhill.com/cgi/test.pl
> http://shevek.kenyonhill.com/perl/test.pl

Sorry for getting late to this thread, this is a bug in mod_deflate. You don't 
see it in mod_cgi, because mod_cgi doesn't really handle buffering and 
flushing, since it just reads the data from the pipe to the process. 
mod_deflate didn't follow the deflate() spec, saying that the caller shouldn't 
call deflate, when there is no data to deflate. Try this patch:

Index: modules/filters/mod_deflate.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_deflate.c,v
retrieving revision 1.26.2.5
diff -u -r1.26.2.5 mod_deflate.c
--- modules/filters/mod_deflate.c       17 May 2003 18:27:43 -0000      1.26.2.5
+++ modules/filters/mod_deflate.c       5 Aug 2003 06:37:59 -0000
@@ -529,9 +529,11 @@

          if (APR_BUCKET_IS_FLUSH(e)) {
              apr_bucket *bkt;
-            zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
-            if (zRC != Z_OK) {
-                return APR_EGENERAL;
+            if (ctx->stream.avail_in > 0) {
+                zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
+                if (zRC != Z_OK) {
+                    return APR_EGENERAL;
+                }
              }

              ctx->stream.next_out = ctx->buffer;

Feel free to submit this bug report and the fix to httpd-dev. Please let me 
know if you do that, so I won't duplicate it. But I'd prefer that you do it so 
you can make sure that it gets fixed in the next release, since you need it 
working.

__________________________________________________________________
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


Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Bill Marrs <bi...@apocalypse.org>.
>We can see that mod_cgi bufferizes the output and sends it with
>Content-Length HTTP header (to mod_deflate). Indeed mod_perl generates
>chunked response. Finally we have the same result. I don't see any problem
>at this moment.

Well, the problem is that I get this error in my error_log:

[Mon Jul 21 14:18:55 2003] [error] 4297: ModPerl::RegistryBB: 20014:Error 
string not specified yet at /var/www/perl/test.pl line 6.

Also, more important, the script seems to be terminating and/or any output 
following the 'print ""' is not sent to the client as far as I can tell.

>You would probably wish to append your script with
>additional output after the empty string? Something like:
>
>#!/usr/bin/perl
>$|=1;
>print "Content-Type: text/html\n\n";
>print "hello world<P>";
># This line causes the error (?)
>print "";
>print "hello again<P>";
>---

When I do this, the mod_perl variant of the script fails to print "hello 
again<P>".

mod_cgi prints everything just fine and gets no errors.

I changed my test script to print a bunch of `date`'s
http://shevek.kenyonhill.com/cgi/test.pl
http://shevek.kenyonhill.com/perl/test.pl

>It may cause a problem for chunked output if mod_deflate does not care to
>keep internal buffer and check its size when flushing...

I may not be understanding the output you sent or what you're saying, but I 
still don't follow why this would be a mod_deflate bug if mod_cgi with the 
same script has no problem.




Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string not specified)

Posted by Slava Bizyayev <sb...@outlook.net>.
Well, let's see:

==> (93.530) Outgoing Request <GET http://shevek.kenyonhill.com/cgi/test.pl
HTTP/1.1>
C05 --> S06 GET /cgi/test.pl HTTP/1.1
C05 --> S06 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, */*
C05 --> S06 Accept-Language: en-us
C05 --> S06 Accept-Encoding: gzip, deflate
C05 --> S06 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
C05 --> S06 Host: shevek.kenyonhill.com
C05 --> S06 Accept-Charset: ISO-8859-1
== Body was 0 bytes ==

C05 <-- S06 HTTP/1.1 200 OK
C05 <-- S06 Date: Mon, 21 Jul 2003 16:30:59 GMT
C05 <-- S06 Server: Apache
C05 <-- S06 Vary: Accept-Encoding,User-Agent
C05 <-- S06 Content-Encoding: gzip
C05 <-- S06 Content-Length: 34
C05 <-- S06 Connection: close
C05 <-- S06 Content-Type: text/html; charset=ISO-8859-1
C05 <-- S06 == Incoming Body was 34 bytes ==
== real URL = http://shevek.kenyonhill.com/cgi/test.pl ==
== Transmission: text gzip  ==
== (93.640) Response 200 to <GET http://shevek.kenyonhill.com/cgi/test.pl
HTTP/1.1>
== Latency = 0.110 seconds, Extra Delay = 0.000 seconds
== Restored Body was 14 bytes ==
== Content Begin: ==
hello world<P>
== Content End ==

==> (164.770) Outgoing Request <GET
http://shevek.kenyonhill.com/perl/test.pl HTTP/1.1>
C05 --> S06 GET /perl/test.pl HTTP/1.1
C05 --> S06 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, */*
C05 --> S06 Accept-Language: en-us
C05 --> S06 Accept-Encoding: gzip, deflate
C05 --> S06 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
C05 --> S06 Host: shevek.kenyonhill.com
C05 --> S06 Accept-Charset: ISO-8859-1
== Body was 0 bytes ==

C05 <-- S06 HTTP/1.1 200 OK
C05 <-- S06 Date: Mon, 21 Jul 2003 16:32:11 GMT
C05 <-- S06 Server: Apache
C05 <-- S06 Vary: Accept-Encoding,User-Agent
C05 <-- S06 Content-Encoding: gzip
C05 <-- S06 Connection: close
C05 <-- S06 Transfer-Encoding: chunked
C05 <-- S06 Content-Type: text/html; charset=ISO-8859-1
C05 <-- S06 == Incoming Body was 629 bytes ==
== real URL = http://shevek.kenyonhill.com/perl/test.pl ==
== Transmission: text gzip chunked ==
== Chunk Log ==
1e (hex) = 30 (dec)
245 (hex) = 581 (dec)
0 (hex) = 0 (dec)
== (164.880) Response 200 to <GET http://shevek.kenyonhill.com/perl/test.pl
HTTP/1.1>
== Latency = 0.110 seconds, Extra Delay = 0.000 seconds
== Restored Body was 14 bytes ==
== Content Begin: ==
hello world<P>
== Content End ==

We can see that mod_cgi bufferizes the output and sends it with
Content-Length HTTP header (to mod_deflate). Indeed mod_perl generates
chunked response. Finally we have the same result. I don't see any problem
at this moment. You would probably wish to append your script with
additional output after the empty string? Something like:

#!/usr/bin/perl
$|=1;
print "Content-Type: text/html\n\n";
print "hello world<P>";
# This line causes the error (?)
print "";
print "hello again<P>";
---

It may cause a problem for chunked output if mod_deflate does not care to
keep internal buffer and check its size when flushing...

Thanks,
Slava


----- Original Message ----- 
From: "Bill Marrs" <bi...@apocalypse.org>
To: "Slava Bizyayev" <sb...@outlook.net>; "Stas Bekman"
<st...@stason.org>; "Philippe M. Chiasson" <go...@cpan.org>
Cc: <mo...@perl.apache.org>
Sent: Monday, July 21, 2003 6:49 AM
Subject: Re: [mp2 Patch] BUG with mod_deflate and $|=1 (20014:Error string
not specified)


>
> >I can measure it myself if you can provide me with URLs to your resources
> >and identify them in terms of which one is mod_CGI and which is mod_perl.
>
> This is the mod_cgi one that works fine, no errors:
> http://shevek.kenyonhill.com/cgi/test.pl
>
> This is the mod_perl one (same script) that generates the "20014:Error" in
> the error_log.  Also, the page doesn't display correctly (it seems to
erase
> itself):
>
> http://shevek.kenyonhill.com/perl/test.pl
>
> This is the contents of test.pl:
>
> ---
> #!/usr/bin/perl
> $|=1;
> print "Content-Type: text/html\n\n";
> print "hello world<P>";
> # This line causes the error
> print "";
> ---
>
> Let me know if you need anything more.
>
>