Stas Bekman wrote:
Even reverting this change I still find that "nmake test" hangs when it gets to that test. Must be something else that's changed since Friday...
Yes, this change?
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/t/filter/TestFilter/out_bbs_filebucket.pm?r1=1.2&r2=1.3
I've reverted that one too, but it still doesn't stop it from hanging.
Hmm, so if you checkout the cvs from Friday, does it work fine?
out_bbs_filebucket.pm @ 1.3, rest @ Sunday: works out_bbs_filebucket.pm @ 1.3, rest @ Monday: not anymore
Changed files between those revisions:
P Changes P Makefile.PL P docs/api/APR/Bucket.pod P docs/api/Apache/Const.pod P docs/api/Apache/Module.pod P docs/api/Apache/PerlSections.pod P docs/devel/porting/porting.pod P docs/user/handlers/filters.pod P docs/user/handlers/http.pod P docs/user/handlers/protocols.pod P docs/user/install/install.pod P lib/Apache/Build.pm P lib/ModPerl/BuildMM.pm P src/modules/perl/modperl_handler.c P src/modules/perl/modperl_util.c P src/modules/perl/modperl_util.h P t/error/syntax.t P t/filter/TestFilter/in_bbs_body.pm P t/filter/TestFilter/in_bbs_inject_header.pm P t/filter/TestFilter/in_bbs_msg.pm P t/filter/TestFilter/out_bbs_basic.pm P t/filter/TestFilter/out_bbs_ctx.pm P t/protocol/echo_bbs.t P t/protocol/TestProtocol/echo_bbs.pm P t/response/TestAPR/bucket.pm P t/response/TestError/syntax.pm P todo/api_status P todo/release P xs/Apache/RequestIO/Apache__RequestIO.h
Some random test combinations involving changed files with fairly varied results:
perl t\TEST t\filter\out_bbs_filebucket.t -> ok
perl t\TEST t\filter\out_bbs_basic.t t\filter\out_bbs_filebucket.t -> ok
perl t\TEST t\filter\out_bbs_body.t t\filter\out_bbs_filebucket.t -> ok
perl t\TEST t\filter\out_bbs_ctx.t t\filter\out_bbs_filebucket.t -> out_bbs_filebucket.t hangs
perl t\TEST t\filter\in_bbs_msg.t t\filter\out_bbs_filebucket.t -> in_bbs_msg.t crashes Apache like in_bbs_inject_header.t
perl t\TEST -v t\protocol\echo_bbs.t t\filter\out_bbs_filebucket.t -> [...] ok 6 # Failed test 7 in t\filter\out_bbs_filebucket.t at line 25 fail #4 # Failed test 8 in t\filter\out_bbs_filebucket.t at line 26 fail #4 # testing : length # expected: 1024000 # received: 18 not ok 7 not ok 8 # testing : length # expected: 5120000 # received: 5120000 ok 9 [...]
I suppose these are the changes that broke things:
diff -ru --exclude=docs --exclude=CVS mp2-20040815/t/filter/TestFilter/in_bbs_body.pm mp2-20040816/t/filter/TestFilter/in_bbs_body.pm
--- mp2-20040815/t/filter/TestFilter/in_bbs_body.pm 2004-08-14 23:30:51.000000000 -0700
+++ mp2-20040816/t/filter/TestFilter/in_bbs_body.pm 2004-08-15 00:55:52.000000000 -0700
@@ -19,27 +19,17 @@
#warn "Called!";
my $ba = $filter->r->connection->bucket_alloc;
- my $ctx_bb = APR::Brigade->new($filter->r->pool, $ba);
+ $filter->next->get_brigade($bb, $mode, $block, $readbytes);
+ for (my $b = $bb->first; $b; $b = $bb->next($b)) {- $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
-
- while (!$ctx_bb->is_empty) {
- my $b = $ctx_bb->first;
-
- $b->remove;
-
- if ($b->is_eos) {
- #warn "EOS!!!!";
- $bb->insert_tail($b);
- last;
- }
+ last if $b->is_eos; if ($b->read(my $data)) {
#warn"[$data]\n";
- $b = APR::Bucket->new(scalar reverse $data);
+ my $nb = APR::Bucket->new(scalar reverse $data);
+ $b->insert_before($nb);
+ $b->remove;
}
-
- $bb->insert_tail($b);
}Apache::OK;
diff -ru --exclude=docs --exclude=CVS mp2-20040815/t/filter/TestFilter/in_bbs_msg.pm mp2-20040816/t/filter/TestFilter/in_bbs_msg.pm
--- mp2-20040815/t/filter/TestFilter/in_bbs_msg.pm 2004-08-14 23:30:50.000000000 -0700
+++ mp2-20040816/t/filter/TestFilter/in_bbs_msg.pm 2004-08-15 00:55:52.000000000 -0700
@@ -23,35 +23,24 @@
debug "FILTER CALLED";
my $c = $filter->c;
- my $ctx_bb = APR::Brigade->new($c->pool, $c->bucket_alloc);- $filter->next->get_brigade($ctx_bb, $mode, $block, $readbytes);
+ $filter->next->get_brigade($bb, $mode, $block, $readbytes);
+ for (my $b = $bb->first; $b; $b = $bb->next($b)) {- while (!$ctx_bb->is_empty) {
- my $b = $ctx_bb->first;
+ last if $b->is_eos;- $b->remove;
-
- if ($b->is_eos) {
- debug "EOS!!!";
- $bb->insert_tail($b);
- last;
- }
-
- $b->read(my $data);
- debug "FILTER READ:\n$data";
-
- if ($data and $data =~ s,GET $from_url,GET $to_url,) {
- debug "GET line rewritten to be:\n$data";
- $b = APR::Bucket->new($data);
+ if ($b->read(my $data)) {
+ next unless $data =~ s|GET $from_url|GET $to_url|;
+ debug "new GET line:\n$data";
+ my $nb = APR::Bucket->new($data);
+ $b->insert_before($nb);
+ $b->remove;
# XXX: currently a bug in httpd doesn't allow to remove
# the first connection filter. once it's fixed adjust the test
# to test that it was invoked only once.
# debug "removing the filter";
# $filter->remove; # this filter is no longer needed
}
-
- $bb->insert_tail($b);
}Apache::OK;
diff -ru --exclude=docs --exclude=CVS mp2-20040815/t/filter/TestFilter/out_bbs_ctx.pm mp2-20040816/t/filter/TestFilter/out_bbs_ctx.pm
--- mp2-20040815/t/filter/TestFilter/out_bbs_ctx.pm 2004-08-14 23:30:50.000000000 -0700
+++ mp2-20040816/t/filter/TestFilter/out_bbs_ctx.pm 2004-08-15 00:55:52.000000000 -0700
@@ -31,7 +31,6 @@
my $data = exists $ctx->{data} ? $ctx->{data} : '';
while (my $b = $bb->first) {
- $b->remove; if ($b->is_eos) {
# flush the remainings and send a stats signature
@@ -44,6 +43,7 @@
} if ($b->read(my $bdata)) {
+ $b->remove;
$data .= $bdata;
my $len = length $data;@@ -59,6 +59,12 @@
$bb_ctx->insert_tail($b);
}
}
+ else {
+ # insert META buckets as is
+ $b->remove;
+ $bb_ctx->insert_tail($b);
+ }
+
}$ctx->{data} = $data;
diff -ru --exclude=docs --exclude=CVS mp2-20040815/t/filter/TestFilter/out_bbs_filebucket.pm mp2-20040816/t/filter/TestFilter/out_bbs_filebucket.pm
--- mp2-20040815/t/filter/TestFilter/out_bbs_filebucket.pm 2004-08-14 11:46:01.000000000 -0700
+++ mp2-20040816/t/filter/TestFilter/out_bbs_filebucket.pm 2004-08-15 00:55:52.000000000 -0700
@@ -23,9 +23,6 @@
sub handler {
my($filter, $bb) = @_;
- my $c = $filter->c;
- my $bb_ctx = APR::Brigade->new($c->pool, $c->bucket_alloc);
-
debug "FILTER INVOKED"; my $cnt = 0;
@@ -34,19 +31,16 @@
$cnt++;
debug "reading bucket #$cnt";- if ($b->is_eos) {
- $b->remove;
- $bb_ctx->insert_tail($b);
- last;
- }
+ last if $b->is_eos; if (my $len = $b->read(my $data)) {
my $nb = APR::Bucket->new(uc $data);
- $bb_ctx->insert_tail($nb);
+ $b->insert_before($nb);
+ $b->remove;
}
}- my $rv = $filter->next->pass_brigade($bb_ctx);
+ my $rv = $filter->next->pass_brigade($bb);
return $rv unless $rv == APR::SUCCESS;return Apache::OK;
diff -ru --exclude=docs --exclude=CVS mp2-20040815/t/protocol/TestProtocol/echo_bbs.pm mp2-20040816/t/protocol/TestProtocol/echo_bbs.pm
--- mp2-20040815/t/protocol/TestProtocol/echo_bbs.pm 2004-06-30 19:01:21.000000000 -0700
+++ mp2-20040816/t/protocol/TestProtocol/echo_bbs.pm 2004-08-15 00:55:52.000000000 -0700
@@ -4,6 +4,9 @@
# manipulations on the buckets inside the connection handler, rather
# then using filter
+# it also demonstrates how to use a single bucket bridade to do all +# the manipulation + use strict; use warnings FATAL => 'all';
@@ -23,38 +26,31 @@
# the socket to a blocking IO mode
$c->client_socket->opt_set(APR::SO_NONBLOCK, 0);- my $bb_in = APR::Brigade->new($c->pool, $c->bucket_alloc); - my $bb_out = APR::Brigade->new($c->pool, $c->bucket_alloc); + my $bb = APR::Brigade->new($c->pool, $c->bucket_alloc);
while (1) {
- my $rc = $c->input_filters->get_brigade($bb_in,
+ my $rc = $c->input_filters->get_brigade($bb,
Apache::MODE_GETLINE);
last if $rc == APR::EOF;
die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;- while (!$bb_in->is_empty) {
- my $bucket = $bb_in->first;
-
- $bucket->remove;
+ for (my $b = $bb->first; $b; $b = $bb->next($b)) {- if ($bucket->is_eos) {
- $bb_out->insert_tail($bucket);
- last;
- }
+ last if $b->is_eos;- if ($bucket->read(my $data)) {
+ if ($b->read(my $data)) {
last if $data =~ /^[\r\n]+$/;
- $bucket = APR::Bucket->new(uc $data);
+ my $nb = APR::Bucket->new(uc $data);
+ # head->...->$nb->$b ->...->tail
+ $b->insert_before($nb);
+ $b->remove;
}
-
- $bb_out->insert_tail($bucket);
}- $c->output_filters->fflush($bb_out);
+ $c->output_filters->fflush($bb);
}- $bb_in->destroy; - $bb_out->destroy; + $bb->destroy;
Apache::OK; }
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
