From normalperson at yhbt.net Sat Mar 1 16:36:58 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 1 Mar 2008 13:36:58 -0800 Subject: [Mongrel-development] [PATCH] avoid needless syscall when num_processors limit is reached In-Reply-To: References: <20080225080111.GA11848@soma> Message-ID: <20080301213658.GA28988@mayonaise> Evan Weaver wrote: > Is there already a ticket for this? I'm not seeing it. No, not for this patch in particular. I was just browsing the mongrel source and this patch just seems like the right thing to do when the num_processors limit is reached. I was referring to another patch in that email (ticket/14, --num-procs not being accepted by mongrel_rails). They're related, but this is just a nitpicky patch and the other one (ticket/14) is a real bug). > On Mon, Feb 25, 2008 at 3:01 AM, Eric Wong wrote: > > Since we're going to close the socket immediately after the > > num_processors limit is reached, there's no point in calling > > setsockopt(2) to enable TCP_CORK on it. Instead, only enable > > TCP_CORK for connections we are able to handle. > > > > While we're at it, avoid calling worker_list.length twice in the > > connection rejected case and instead just set num_workers to > > @workers.list.length once. I'm assuming the original caching of > > worker_list = @workers.list to avoid having the log message > > display a different number due to a race condition; and this > > preserves that functionality while avoiding an extra method call. > > > > --- > > This patch is against > > svn://rubyforge.org/var/svn/mongrel/branches/stable_1-1 r981 > > > > lib/mongrel.rb | 16 +++++++--------- > > 1 files changed, 7 insertions(+), 9 deletions(-) > > > > diff --git a/lib/mongrel.rb b/lib/mongrel.rb > > index d99c56d..cfdfc49 100644 > > --- a/lib/mongrel.rb > > +++ b/lib/mongrel.rb > > @@ -270,18 +270,16 @@ module Mongrel > > while true > > begin > > client = @socket.accept > > - > > - if defined?($tcp_cork_opts) and $tcp_cork_opts > > - client.setsockopt(*$tcp_cork_opts) rescue nil > > - end > > - > > - worker_list = @workers.list > > - > > - if worker_list.length >= @num_processors > > - STDERR.puts "Server overloaded with #{worker_list.length} processors (#@num_processors max). Dropping connection." > > + > > + num_workers = @workers.list.length > > + if num_workers >= @num_processors > > + STDERR.puts "Server overloaded with #{num_workers} processors (#@num_processors max). Dropping connection." > > client.close rescue nil > > reap_dead_workers("max processors") > > else > > + if defined?($tcp_cork_opts) and $tcp_cork_opts > > + client.setsockopt(*$tcp_cork_opts) rescue nil > > + end > > thread = Thread.new(client) {|c| process_client(c) } > > thread[:started_on] = Time.now > > @workers.add(thread) > > -- > > Eric Wong From normalperson at yhbt.net Sat Mar 1 16:38:53 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 1 Mar 2008 13:38:53 -0800 Subject: [Mongrel-development] [PATCH (trivial)] test/unit/test_ws: fix require after 'testhelp' got renamed to 'test_helper' In-Reply-To: References: <20080229015309.GA9080@untitled> Message-ID: <20080301213853.GB28988@mayonaise> Tests all run correctly on the stable_1-2 branch now. --- Since I'm looking at the tests... :) Evan Weaver wrote: > That would be great; I haven't gotten to it. Can you merge it against > branches/stable_1-2? > > Also make sure to add a test if it changes any API or adds any functionality. > > Thanks > > Evan test/unit/test_ws.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/test/unit/test_ws.rb b/test/unit/test_ws.rb index d239e18..68a79a8 100644 --- a/test/unit/test_ws.rb +++ b/test/unit/test_ws.rb @@ -4,7 +4,7 @@ # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html # for more information. -require 'test/testhelp' +require 'test/test_helper' include Mongrel -- Eric Wong From evan at cloudbur.st Sat Mar 1 16:48:05 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 1 Mar 2008 16:48:05 -0500 Subject: [Mongrel-development] [PATCH (trivial)] test/unit/test_ws: fix require after 'testhelp' got renamed to 'test_helper' In-Reply-To: <20080301213853.GB28988@mayonaise> References: <20080229015309.GA9080@untitled> <20080301213853.GB28988@mayonaise> Message-ID: Applied, thanks. Do you want a commit bit? What's your RubyForge name? Evan On Sat, Mar 1, 2008 at 4:38 PM, Eric Wong wrote: > Tests all run correctly on the stable_1-2 branch now. > --- > > Since I'm looking at the tests... :) > > Evan Weaver wrote: > > That would be great; I haven't gotten to it. Can you merge it against > > branches/stable_1-2? > > > > Also make sure to add a test if it changes any API or adds any functionality. > > > > Thanks > > > > Evan > > test/unit/test_ws.rb | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/test/unit/test_ws.rb b/test/unit/test_ws.rb > index d239e18..68a79a8 100644 > --- a/test/unit/test_ws.rb > +++ b/test/unit/test_ws.rb > @@ -4,7 +4,7 @@ > # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html > # for more information. > > -require 'test/testhelp' > +require 'test/test_helper' > > include Mongrel > > -- > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From normalperson at yhbt.net Sat Mar 1 17:24:19 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 1 Mar 2008 14:24:19 -0800 Subject: [Mongrel-development] [PATCH (trivial)] test/unit/test_ws: fix require after 'testhelp' got renamed to 'test_helper' In-Reply-To: References: <20080229015309.GA9080@untitled> <20080301213853.GB28988@mayonaise> Message-ID: <20080301222419.GA9727@soma> Evan Weaver wrote: > Applied, thanks. > > Do you want a commit bit? What's your RubyForge name? Sure, I'm normalperson: http://rubyforge.org/users/normalperson/ Thanks! > Evan > > On Sat, Mar 1, 2008 at 4:38 PM, Eric Wong wrote: > > Tests all run correctly on the stable_1-2 branch now. > > --- > > > > Since I'm looking at the tests... :) > > > > Evan Weaver wrote: > > > That would be great; I haven't gotten to it. Can you merge it against > > > branches/stable_1-2? > > > > > > Also make sure to add a test if it changes any API or adds any functionality. > > > > > > Thanks > > > > > > Evan > > > > test/unit/test_ws.rb | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/test/unit/test_ws.rb b/test/unit/test_ws.rb > > index d239e18..68a79a8 100644 > > --- a/test/unit/test_ws.rb > > +++ b/test/unit/test_ws.rb > > @@ -4,7 +4,7 @@ > > # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html > > # for more information. > > > > -require 'test/testhelp' > > +require 'test/test_helper' > > > > include Mongrel > > > > -- > > Eric Wong From evan at cloudbur.st Sat Mar 1 18:41:44 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 1 Mar 2008 18:41:44 -0500 Subject: [Mongrel-development] [PATCH (trivial)] test/unit/test_ws: fix require after 'testhelp' got renamed to 'test_helper' In-Reply-To: <20080301222419.GA9727@soma> References: <20080229015309.GA9080@untitled> <20080301213853.GB28988@mayonaise> <20080301222419.GA9727@soma> Message-ID: Added you. Evan On Sat, Mar 1, 2008 at 5:24 PM, Eric Wong wrote: > Evan Weaver wrote: > > > Applied, thanks. > > > > Do you want a commit bit? What's your RubyForge name? > > Sure, I'm normalperson: http://rubyforge.org/users/normalperson/ > > Thanks! > > > > > Evan > > > > On Sat, Mar 1, 2008 at 4:38 PM, Eric Wong wrote: > > > Tests all run correctly on the stable_1-2 branch now. > > > --- > > > > > > Since I'm looking at the tests... :) > > > > > > Evan Weaver wrote: > > > > That would be great; I haven't gotten to it. Can you merge it against > > > > branches/stable_1-2? > > > > > > > > Also make sure to add a test if it changes any API or adds any functionality. > > > > > > > > Thanks > > > > > > > > Evan > > > > > > test/unit/test_ws.rb | 2 +- > > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > > > diff --git a/test/unit/test_ws.rb b/test/unit/test_ws.rb > > > index d239e18..68a79a8 100644 > > > --- a/test/unit/test_ws.rb > > > +++ b/test/unit/test_ws.rb > > > @@ -4,7 +4,7 @@ > > > # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html > > > # for more information. > > > > > > -require 'test/testhelp' > > > +require 'test/test_helper' > > > > > > include Mongrel > > > > > > -- > > > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From normalperson at yhbt.net Sat Mar 1 18:52:46 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 1 Mar 2008 15:52:46 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080229222731.GA13406@untitled> References: <20080229015309.GA9080@untitled> <3ae7f4480802290203v50023b57se867e531c162f066@mail.gmail.com> <3ae7f4480802290221o2929dd9ev154859dd5475808c@mail.gmail.com> <20080229222731.GA13406@untitled> Message-ID: <20080301235246.GA30656@mayonaise> Eric Wong wrote: > ry dahl wrote: > > while i'm nitpicking...:P > > > > #define ASCII_UPPER(ch) ('a' <= ch && ch <= 'z' ? ch - 'a' + 'A' : ch) > > > > memcpy( RSTRING_PTR(f) > > , RSTRING_PTR(global_http_prefix) > > , RSTRING_LEN(global_http_prefix) > > ); > > for(i = 0; i < length; i++) { > > ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i; > > if(field[i] == '-') { > > *ch = '_'; > > } else { > > *ch = ASCII_UPPER(field[i]); > > } > > } > > The ASCII_UPPER helps readability, thanks. > > I haven't had a chance to benchmark your for loop vs my while loop I > wrote, but given the wide variety of compilers, versions and options, I > expect my while loop to be slightly faster in general. My version is about 0.3% faster :) > Additionally, reordering the if/else condition to put the more common > case first didn't seem to help in my case (gcc 4.1.1-21 from Debian, > -O2), so I left it alone. > > However, I haven't tried __builtin_expect() here, either (fast_xs did > benefit from __builtin_expect() in my tests). __builtin_expect didn't help, probably because the common cases (lowercase chars) for HTTP headers don't overwhelmingly favor the less common cases (non-lowercase chars). > Perhaps rolling the checks together would be fastest, eliminating > a redundant check for '-' if it's lowercase, still: > > *ch = ('a' <= *fch && *fch <= 'z') ? > (*fch - 'a' + 'A') : > (*fch != '-' ? *fch : '_'); > Not that other inefficiencies drastically overshadow the increases > we get here :) Here's my updated version, I've removed the extra 'i' variable and made the code a little more compact (and hopefully more readable) (with no measurable performance impact from my original). I kept the bitwise operation for uppercasing instead of relying on subtraction since it's typically faster (no sign/overflow checks) although hard to measure in real-world performance here (my compiler (gcc 4.1.1-21 -O2 on Debian/x86) preserved the subb instruction). diff --git a/ext/http11/ext_help.h b/ext/http11/ext_help.h index 8b4d754..1017c64 100644 --- a/ext/http11/ext_help.h +++ b/ext/http11/ext_help.h @@ -4,6 +4,8 @@ #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be."); #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name); #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T); +#define ASCII_UPCASE_CHAR(ch) (ch & ~0x20) + #ifdef DEBUG #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__) diff --git a/ext/http11/http11.c b/ext/http11/http11.c index 2982467..8e46e4c 100644 --- a/ext/http11/http11.c +++ b/ext/http11/http11.c @@ -7,7 +7,6 @@ #include #include #include "http11_parser.h" -#include static VALUE mMongrel; static VALUE cHttpParser; @@ -62,7 +61,8 @@ DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32))); void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen) { - char *ch, *end; + char *ch; + const char *fch; VALUE req = (VALUE)data; VALUE v = Qnil; VALUE f = Qnil; @@ -71,15 +71,24 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE); v = rb_str_new(value, vlen); - f = rb_str_dup(global_http_prefix); - f = rb_str_buf_cat(f, field, flen); - for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) { - if(*ch == '-') { - *ch = '_'; - } else { - *ch = toupper(*ch); - } + /* + * using rb_str_new(NULL, len) here is faster than rb_str_buf_new(len) + * in my testing, because: there's no minimum allocation length (and + * no check for it, either), RSTRING(f)->len does not need to be + * written twice, and and RSTRING(f)->ptr[len] will already be + * null-terminated for us. + */ + f = rb_str_new(NULL, RSTRING(global_http_prefix)->len + flen); + memcpy(RSTRING(f)->ptr, + RSTRING(global_http_prefix)->ptr, + RSTRING(global_http_prefix)->len); + + ch = RSTRING(f)->ptr + RSTRING(global_http_prefix)->len; + for(fch = field; flen-- != 0; ++fch) { + *ch++ = (*fch >= 'a' && *fch <= 'z') ? + ASCII_UPCASE_CHAR(*fch) : + (*fch == '-' ? '_' : *fch); } rb_hash_aset(req, f, v); -- Eric Wong From filipe at icewall.org Sat Mar 1 20:43:28 2008 From: filipe at icewall.org (Filipe) Date: Sat, 1 Mar 2008 22:43:28 -0300 (BRT) Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080301235246.GA30656@mayonaise> References: <20080229015309.GA9080@untitled> <3ae7f4480802290203v50023b57se867e531c162f066@mail.gmail.com> <3ae7f4480802290221o2929dd9ev154859dd5475808c@mail.gmail.com> <20080229222731.GA13406@untitled> <20080301235246.GA30656@mayonaise> Message-ID: Hey Eric! as now you have commit permission, please apply the patches yourself to head. after testing it on head we can add this to branches, ok? Cheers, filipe { @ icewall.org GPG 1024D/A6BA423E http://filipe.icewall.org/ } On Sat, 1 Mar 2008, Eric Wong wrote: > Eric Wong wrote: >> ry dahl wrote: >>> while i'm nitpicking...:P >>> >>> #define ASCII_UPPER(ch) ('a' <= ch && ch <= 'z' ? ch - 'a' + 'A' : ch) >>> >>> memcpy( RSTRING_PTR(f) >>> , RSTRING_PTR(global_http_prefix) >>> , RSTRING_LEN(global_http_prefix) >>> ); >>> for(i = 0; i < length; i++) { >>> ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i; >>> if(field[i] == '-') { >>> *ch = '_'; >>> } else { >>> *ch = ASCII_UPPER(field[i]); >>> } >>> } >> >> The ASCII_UPPER helps readability, thanks. >> >> I haven't had a chance to benchmark your for loop vs my while loop I >> wrote, but given the wide variety of compilers, versions and options, I >> expect my while loop to be slightly faster in general. > > My version is about 0.3% faster :) > >> Additionally, reordering the if/else condition to put the more common >> case first didn't seem to help in my case (gcc 4.1.1-21 from Debian, >> -O2), so I left it alone. >> >> However, I haven't tried __builtin_expect() here, either (fast_xs did >> benefit from __builtin_expect() in my tests). > > __builtin_expect didn't help, probably because the common cases > (lowercase chars) for HTTP headers don't overwhelmingly favor the less > common cases (non-lowercase chars). > >> Perhaps rolling the checks together would be fastest, eliminating >> a redundant check for '-' if it's lowercase, still: >> >> *ch = ('a' <= *fch && *fch <= 'z') ? >> (*fch - 'a' + 'A') : >> (*fch != '-' ? *fch : '_'); > >> Not that other inefficiencies drastically overshadow the increases >> we get here :) > > Here's my updated version, I've removed the extra 'i' variable and made > the code a little more compact (and hopefully more readable) (with no > measurable performance impact from my original). > > I kept the bitwise operation for uppercasing instead of relying on > subtraction since it's typically faster (no sign/overflow checks) > although hard to measure in real-world performance here (my compiler > (gcc 4.1.1-21 -O2 on Debian/x86) preserved the subb instruction). > > diff --git a/ext/http11/ext_help.h b/ext/http11/ext_help.h > index 8b4d754..1017c64 100644 > --- a/ext/http11/ext_help.h > +++ b/ext/http11/ext_help.h > @@ -4,6 +4,8 @@ > #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be."); > #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name); > #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T); > +#define ASCII_UPCASE_CHAR(ch) (ch & ~0x20) > + > > #ifdef DEBUG > #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__) > diff --git a/ext/http11/http11.c b/ext/http11/http11.c > index 2982467..8e46e4c 100644 > --- a/ext/http11/http11.c > +++ b/ext/http11/http11.c > @@ -7,7 +7,6 @@ > #include > #include > #include "http11_parser.h" > -#include > > static VALUE mMongrel; > static VALUE cHttpParser; > @@ -62,7 +61,8 @@ DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32))); > > void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen) > { > - char *ch, *end; > + char *ch; > + const char *fch; > VALUE req = (VALUE)data; > VALUE v = Qnil; > VALUE f = Qnil; > @@ -71,15 +71,24 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s > VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE); > > v = rb_str_new(value, vlen); > - f = rb_str_dup(global_http_prefix); > - f = rb_str_buf_cat(f, field, flen); > > - for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) { > - if(*ch == '-') { > - *ch = '_'; > - } else { > - *ch = toupper(*ch); > - } > + /* > + * using rb_str_new(NULL, len) here is faster than rb_str_buf_new(len) > + * in my testing, because: there's no minimum allocation length (and > + * no check for it, either), RSTRING(f)->len does not need to be > + * written twice, and and RSTRING(f)->ptr[len] will already be > + * null-terminated for us. > + */ > + f = rb_str_new(NULL, RSTRING(global_http_prefix)->len + flen); > + memcpy(RSTRING(f)->ptr, > + RSTRING(global_http_prefix)->ptr, > + RSTRING(global_http_prefix)->len); > + > + ch = RSTRING(f)->ptr + RSTRING(global_http_prefix)->len; > + for(fch = field; flen-- != 0; ++fch) { > + *ch++ = (*fch >= 'a' && *fch <= 'z') ? > + ASCII_UPCASE_CHAR(*fch) : > + (*fch == '-' ? '_' : *fch); > } > > rb_hash_aset(req, f, v); > -- > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > From normalperson at yhbt.net Sat Mar 1 21:39:21 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 1 Mar 2008 18:39:21 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: References: <20080229015309.GA9080@untitled> <3ae7f4480802290203v50023b57se867e531c162f066@mail.gmail.com> <3ae7f4480802290221o2929dd9ev154859dd5475808c@mail.gmail.com> <20080229222731.GA13406@untitled> <20080301235246.GA30656@mayonaise> Message-ID: <20080302023921.GA8733@mayonaise> Filipe wrote: > > Hey Eric! as now you have commit permission, please apply the patches > yourself to head. after testing it on head we can add this to branches, > ok? All three applied to trunk: r989 | http11: ~6% performance increase in header parsing r988 | mongrel: avoid needless syscall when num_processors limit is reached r987 | mongrel_rails: support -n/--num-procs command-line option I also noticed there was a general performance decrease in the trunk HTTP parser versus stable-1-1 and 1-2. I haven't had time to dig into this, yet. r989 seems to bring it inline with the performance of the unpatched stable-1-2 branch... > On Sat, 1 Mar 2008, Eric Wong wrote: > > > Eric Wong wrote: > >> ry dahl wrote: > >>> while i'm nitpicking...:P > >>> > >>> #define ASCII_UPPER(ch) ('a' <= ch && ch <= 'z' ? ch - 'a' + 'A' : ch) > >>> > >>> memcpy( RSTRING_PTR(f) > >>> , RSTRING_PTR(global_http_prefix) > >>> , RSTRING_LEN(global_http_prefix) > >>> ); > >>> for(i = 0; i < length; i++) { > >>> ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i; > >>> if(field[i] == '-') { > >>> *ch = '_'; > >>> } else { > >>> *ch = ASCII_UPPER(field[i]); > >>> } > >>> } > >> > >> The ASCII_UPPER helps readability, thanks. > >> > >> I haven't had a chance to benchmark your for loop vs my while loop I > >> wrote, but given the wide variety of compilers, versions and options, I > >> expect my while loop to be slightly faster in general. > > > > My version is about 0.3% faster :) > > > >> Additionally, reordering the if/else condition to put the more common > >> case first didn't seem to help in my case (gcc 4.1.1-21 from Debian, > >> -O2), so I left it alone. > >> > >> However, I haven't tried __builtin_expect() here, either (fast_xs did > >> benefit from __builtin_expect() in my tests). > > > > __builtin_expect didn't help, probably because the common cases > > (lowercase chars) for HTTP headers don't overwhelmingly favor the less > > common cases (non-lowercase chars). > > > >> Perhaps rolling the checks together would be fastest, eliminating > >> a redundant check for '-' if it's lowercase, still: > >> > >> *ch = ('a' <= *fch && *fch <= 'z') ? > >> (*fch - 'a' + 'A') : > >> (*fch != '-' ? *fch : '_'); > > > >> Not that other inefficiencies drastically overshadow the increases > >> we get here :) > > > > Here's my updated version, I've removed the extra 'i' variable and made > > the code a little more compact (and hopefully more readable) (with no > > measurable performance impact from my original). > > > > I kept the bitwise operation for uppercasing instead of relying on > > subtraction since it's typically faster (no sign/overflow checks) > > although hard to measure in real-world performance here (my compiler > > (gcc 4.1.1-21 -O2 on Debian/x86) preserved the subb instruction). > > > > diff --git a/ext/http11/ext_help.h b/ext/http11/ext_help.h > > index 8b4d754..1017c64 100644 > > --- a/ext/http11/ext_help.h > > +++ b/ext/http11/ext_help.h > > @@ -4,6 +4,8 @@ > > #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be."); > > #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name); > > #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T); > > +#define ASCII_UPCASE_CHAR(ch) (ch & ~0x20) > > + > > > > #ifdef DEBUG > > #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__) > > diff --git a/ext/http11/http11.c b/ext/http11/http11.c > > index 2982467..8e46e4c 100644 > > --- a/ext/http11/http11.c > > +++ b/ext/http11/http11.c > > @@ -7,7 +7,6 @@ > > #include > > #include > > #include "http11_parser.h" > > -#include > > > > static VALUE mMongrel; > > static VALUE cHttpParser; > > @@ -62,7 +61,8 @@ DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32))); > > > > void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen) > > { > > - char *ch, *end; > > + char *ch; > > + const char *fch; > > VALUE req = (VALUE)data; > > VALUE v = Qnil; > > VALUE f = Qnil; > > @@ -71,15 +71,24 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s > > VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE); > > > > v = rb_str_new(value, vlen); > > - f = rb_str_dup(global_http_prefix); > > - f = rb_str_buf_cat(f, field, flen); > > > > - for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) { > > - if(*ch == '-') { > > - *ch = '_'; > > - } else { > > - *ch = toupper(*ch); > > - } > > + /* > > + * using rb_str_new(NULL, len) here is faster than rb_str_buf_new(len) > > + * in my testing, because: there's no minimum allocation length (and > > + * no check for it, either), RSTRING(f)->len does not need to be > > + * written twice, and and RSTRING(f)->ptr[len] will already be > > + * null-terminated for us. > > + */ > > + f = rb_str_new(NULL, RSTRING(global_http_prefix)->len + flen); > > + memcpy(RSTRING(f)->ptr, > > + RSTRING(global_http_prefix)->ptr, > > + RSTRING(global_http_prefix)->len); > > + > > + ch = RSTRING(f)->ptr + RSTRING(global_http_prefix)->len; > > + for(fch = field; flen-- != 0; ++fch) { > > + *ch++ = (*fch >= 'a' && *fch <= 'z') ? > > + ASCII_UPCASE_CHAR(*fch) : > > + (*fch == '-' ? '_' : *fch); > > } > > > > rb_hash_aset(req, f, v); > > -- > > Eric Wong From evan at cloudbur.st Sat Mar 1 22:15:01 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 1 Mar 2008 22:15:01 -0500 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080302023921.GA8733@mayonaise> References: <20080229015309.GA9080@untitled> <3ae7f4480802290203v50023b57se867e531c162f066@mail.gmail.com> <3ae7f4480802290221o2929dd9ev154859dd5475808c@mail.gmail.com> <20080229222731.GA13406@untitled> <20080301235246.GA30656@mayonaise> <20080302023921.GA8733@mayonaise> Message-ID: Trunk has the Ruby 1.9 compatibility changes, which might have something to do with it. Those need to get backported to stable_1-2 at some point. Trunk also has a new logger that Wayne wrote. That could be degrading the parser performance somehow. Evan On Sat, Mar 1, 2008 at 9:39 PM, Eric Wong wrote: > Filipe wrote: > > > > > Hey Eric! as now you have commit permission, please apply the patches > > yourself to head. after testing it on head we can add this to branches, > > ok? > > All three applied to trunk: > > r989 | http11: ~6% performance increase in header parsing > r988 | mongrel: avoid needless syscall when num_processors limit is reached > r987 | mongrel_rails: support -n/--num-procs command-line option > > I also noticed there was a general performance decrease in the trunk > HTTP parser versus stable-1-1 and 1-2. I haven't had time to dig > into this, yet. r989 seems to bring it inline with the performance > of the unpatched stable-1-2 branch... > > > > > On Sat, 1 Mar 2008, Eric Wong wrote: > > > > > Eric Wong wrote: > > >> ry dahl wrote: > > >>> while i'm nitpicking...:P > > >>> > > >>> #define ASCII_UPPER(ch) ('a' <= ch && ch <= 'z' ? ch - 'a' + 'A' : ch) > > >>> > > >>> memcpy( RSTRING_PTR(f) > > >>> , RSTRING_PTR(global_http_prefix) > > >>> , RSTRING_LEN(global_http_prefix) > > >>> ); > > >>> for(i = 0; i < length; i++) { > > >>> ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i; > > >>> if(field[i] == '-') { > > >>> *ch = '_'; > > >>> } else { > > >>> *ch = ASCII_UPPER(field[i]); > > >>> } > > >>> } > > >> > > >> The ASCII_UPPER helps readability, thanks. > > >> > > >> I haven't had a chance to benchmark your for loop vs my while loop I > > >> wrote, but given the wide variety of compilers, versions and options, I > > >> expect my while loop to be slightly faster in general. > > > > > > My version is about 0.3% faster :) > > > > > >> Additionally, reordering the if/else condition to put the more common > > >> case first didn't seem to help in my case (gcc 4.1.1-21 from Debian, > > >> -O2), so I left it alone. > > >> > > >> However, I haven't tried __builtin_expect() here, either (fast_xs did > > >> benefit from __builtin_expect() in my tests). > > > > > > __builtin_expect didn't help, probably because the common cases > > > (lowercase chars) for HTTP headers don't overwhelmingly favor the less > > > common cases (non-lowercase chars). > > > > > >> Perhaps rolling the checks together would be fastest, eliminating > > >> a redundant check for '-' if it's lowercase, still: > > >> > > >> *ch = ('a' <= *fch && *fch <= 'z') ? > > >> (*fch - 'a' + 'A') : > > >> (*fch != '-' ? *fch : '_'); > > > > > >> Not that other inefficiencies drastically overshadow the increases > > >> we get here :) > > > > > > Here's my updated version, I've removed the extra 'i' variable and made > > > the code a little more compact (and hopefully more readable) (with no > > > measurable performance impact from my original). > > > > > > I kept the bitwise operation for uppercasing instead of relying on > > > subtraction since it's typically faster (no sign/overflow checks) > > > although hard to measure in real-world performance here (my compiler > > > (gcc 4.1.1-21 -O2 on Debian/x86) preserved the subb instruction). > > > > > > diff --git a/ext/http11/ext_help.h b/ext/http11/ext_help.h > > > index 8b4d754..1017c64 100644 > > > --- a/ext/http11/ext_help.h > > > +++ b/ext/http11/ext_help.h > > > @@ -4,6 +4,8 @@ > > > #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be."); > > > #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name); > > > #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T); > > > +#define ASCII_UPCASE_CHAR(ch) (ch & ~0x20) > > > + > > > > > > #ifdef DEBUG > > > #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__) > > > diff --git a/ext/http11/http11.c b/ext/http11/http11.c > > > index 2982467..8e46e4c 100644 > > > --- a/ext/http11/http11.c > > > +++ b/ext/http11/http11.c > > > @@ -7,7 +7,6 @@ > > > #include > > > #include > > > #include "http11_parser.h" > > > -#include > > > > > > static VALUE mMongrel; > > > static VALUE cHttpParser; > > > @@ -62,7 +61,8 @@ DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32))); > > > > > > void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen) > > > { > > > - char *ch, *end; > > > + char *ch; > > > + const char *fch; > > > VALUE req = (VALUE)data; > > > VALUE v = Qnil; > > > VALUE f = Qnil; > > > @@ -71,15 +71,24 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s > > > VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE); > > > > > > v = rb_str_new(value, vlen); > > > - f = rb_str_dup(global_http_prefix); > > > - f = rb_str_buf_cat(f, field, flen); > > > > > > - for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) { > > > - if(*ch == '-') { > > > - *ch = '_'; > > > - } else { > > > - *ch = toupper(*ch); > > > - } > > > + /* > > > + * using rb_str_new(NULL, len) here is faster than rb_str_buf_new(len) > > > + * in my testing, because: there's no minimum allocation length (and > > > + * no check for it, either), RSTRING(f)->len does not need to be > > > + * written twice, and and RSTRING(f)->ptr[len] will already be > > > + * null-terminated for us. > > > + */ > > > + f = rb_str_new(NULL, RSTRING(global_http_prefix)->len + flen); > > > + memcpy(RSTRING(f)->ptr, > > > + RSTRING(global_http_prefix)->ptr, > > > + RSTRING(global_http_prefix)->len); > > > + > > > + ch = RSTRING(f)->ptr + RSTRING(global_http_prefix)->len; > > > + for(fch = field; flen-- != 0; ++fch) { > > > + *ch++ = (*fch >= 'a' && *fch <= 'z') ? > > > + ASCII_UPCASE_CHAR(*fch) : > > > + (*fch == '-' ? '_' : *fch); > > > } > > > > > > rb_hash_aset(req, f, v); > > > -- > > > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From zedshaw at zedshaw.com Mon Mar 3 04:46:59 2008 From: zedshaw at zedshaw.com (Zed A. Shaw) Date: Mon, 3 Mar 2008 04:46:59 -0500 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080229015309.GA9080@untitled> References: <20080229015309.GA9080@untitled> Message-ID: <20080303044659.5a550c19.zedshaw@zedshaw.com> On Thu, 28 Feb 2008 17:53:09 -0800 Eric Wong wrote: > Allocate one string object and avoid appending to it causing it > to be resized. Additionally, optimize the string toupper copy > so that it's done in a single pass. Not bad, but I have some code style comments on your C code: * I think the RSTRING macro is going away in the new ruby. Ran into that recently. * Your inner loop isn't that readable and too clever. The original for loop is clear, and should have the same or more speed when handed to a modern compiler. Since you either already know the length of the target string, or it's a ruby string that ends in \0, just use a regular pointer loop to go through the string. No point starting at the back and decrementing a counter that also increment other pointers. Additionally, the compiler should make it faster with pointers directly instead and there's CPU operations that do this natively anyway, but nothing using the non-standard backward-increment-forward-dual-pointers thing you have. * After your memcpy you don't clamp the string with a \0 since you're relying on the backwards loop to do it. This is kind of too clever to be useful, so I'd do it the regular way and memcpy then set '\0'. That's also safer. * You should also double check the code in ruby to make sure that any other RString internals don't need to be updated. I believe there's a few other things that have to be touched to keep ruby sane for some operations. Look at how the ruby dup operations are done. * You should get some real HTTP test samples, the worse the better. All you've done is shown that it's marginally faster for a single run of a simple set of headers. I'd validate other combinations before putting in code this complex for just a small boost like that. * Also, now that I think about it, if you don't care that the original string is modified in place then you can just have ragel do all of this as it goes. Simply modify the parser to have it do this transform on the header chars using the existing pointer. That'd probably be alright since people don't usually keep the input headers around when using the mongrel parser. Give those suggestions a try and see what you get. Thanks for helping out Eric. Zed > void http_field(void *data, const char *field, size_t flen, const char *value, size_t vlen) > { > - char *ch, *end; > + char *ch; > + const char *fch; > + int i; > VALUE req = (VALUE)data; > VALUE v = Qnil; > VALUE f = Qnil; > @@ -71,15 +72,30 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s > VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE); > > v = rb_str_new(value, vlen); > - f = rb_str_dup(global_http_prefix); > - f = rb_str_buf_cat(f, field, flen); > > - for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) { > - if(*ch == '-') { > + /* > + * using rb_str_new(NULL, len) here is faster than rb_str_buf_new(len) > + * in my testing, because: there's no minimum allocation length (and > + * no check for it, either), RSTRING(f)->len does not need to be > + * written twice, and and RSTRING(f)->ptr[len] will already be > + * null-terminated for us. > + */ > + f = rb_str_new(NULL, RSTRING(global_http_prefix)->len + flen); > + memcpy(RSTRING(f)->ptr, > + RSTRING(global_http_prefix)->ptr, > + RSTRING(global_http_prefix)->len); > + > + i = (int)flen; > + fch = field; > + ch = RSTRING(f)->ptr + RSTRING(global_http_prefix)->len; > + while(--i >= 0) { > + if(*fch == '-') { > *ch = '_'; > } else { > - *ch = toupper(*ch); > + *ch = (*fch >= 'a' && *fch <= 'z') ? (*fch & ~0x20) : *fch; > } > + ++ch; > + ++fch; > } > > rb_hash_aset(req, f, v); > -- > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development -- Zed A. Shaw - Hate: http://savingtheinternetwithhate.com/ - Good: http://www.zedshaw.com/ - Evil: http://yearofevil.com/ From normalperson at yhbt.net Sun Mar 2 07:37:12 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sun, 2 Mar 2008 04:37:12 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080303044659.5a550c19.zedshaw@zedshaw.com> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> Message-ID: <20080302123712.GA13979@hand.yhbt.net> "Zed A. Shaw" wrote: > On Thu, 28 Feb 2008 17:53:09 -0800 > Eric Wong wrote: > > > Allocate one string object and avoid appending to it causing it > > to be resized. Additionally, optimize the string toupper copy > > so that it's done in a single pass. > > Not bad, but I have some code style comments on your C code: > > * I think the RSTRING macro is going away in the new ruby. Ran into > that recently. Yup. The version I committed to trunk uses the 1.9-compatible RSTRING_{PTR,LEN} macros > * Your inner loop isn't that readable and too clever. The original > for loop is clear, and should have the same or more speed when > handed to a modern compiler. Since you either already know the length > of the target string, or it's a ruby string that ends in \0, just use a > regular pointer loop to go through the string. No point starting at > the back and decrementing a counter that also increment other pointers. > Additionally, the compiler should make it faster with pointers directly > instead and there's CPU operations that do this natively anyway, but > nothing using the non-standard backward-increment-forward-dual-pointers > thing you have. I actually shortened the one committed to trunk a bit (but used nested ternary operators, so I may rewrite that for better readability). It modifies flen directly instead of copying it to a temporary variable. I don't think Ragel actually terminates field with '\0', but I'll double check later. > * After your memcpy you don't clamp the string with a \0 since you're > relying on the backwards loop to do it. This is kind of too clever to > be useful, so I'd do it the regular way and memcpy then set '\0'. > That's also safer. rb_str_new() actually does it, the loop shouldn't overwrite it. But I understand if you want me to clamp it again manually for easier auditing. > * You > should also double check the code in ruby to make sure that > any other RString internals don't need to be updated. I believe > there's a few other things that have to be touched to keep ruby sane > for some operations. Look at how the ruby dup operations are done. > * You should get some real HTTP test samples, the worse the better. > All you've done is shown that it's marginally faster for a single run > of a simple set of headers. I'd validate other combinations before > putting in code this complex for just a small boost like that. > * Also, now that I think about it, if you don't care that the original > string is modified in place then you can just have ragel do all of this > as it goes. Simply modify the parser to have it do this transform on > the header chars using the existing pointer. That'd probably be > alright since people don't usually keep the input headers around when > using the mongrel parser. I'll look into all of those three. I think I saw rb_str_modify() but either forgot to use it or figured I didn't need it :X > Give those suggestions a try and see what you get. Thanks for helping > out Eric. Thanks for the feedback, Zed. There's also something else that occured to me is why we always create a new RString object in the first place if it's getting set into a Hash (and frozen). I suspect we'll get a much bigger performance increase by avoiding redundant object creation when we get common header names and directly using global objects to represent them (like global_http_host). Additionally, my understanding is that frozen objects never get GC-ed, and since strings get frozen when being put into a hash, this could be a memory leak if somebody unleashes a random header generator. Maybe we should keep a global store of predefined HTTP headers we always accept (all those mentioned in HTTP RFCs), and leave 100 or so slots open for some random headers clients may put in; letting those weird clients fill those slots on a first-come basis. Afterwards, any new headers we haven't seen and don't know about would either raise an exception or get silently dropped ... This would prevent memory leaks if my understanding of frozen objects is correct... Way past my bedtime to test these things now, though. -- Eric Wong From evan at cloudbur.st Sun Mar 2 15:31:44 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sun, 2 Mar 2008 15:31:44 -0500 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080302123712.GA13979@hand.yhbt.net> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> Message-ID: > This would prevent memory leaks if my understanding of frozen objects > is correct... I don't think the GC treats frozen objects in any special way. Evan On Sun, Mar 2, 2008 at 7:37 AM, Eric Wong wrote: > "Zed A. Shaw" wrote: > > On Thu, 28 Feb 2008 17:53:09 -0800 > > Eric Wong wrote: > > > > > Allocate one string object and avoid appending to it causing it > > > to be resized. Additionally, optimize the string toupper copy > > > so that it's done in a single pass. > > > > Not bad, but I have some code style comments on your C code: > > > > * I think the RSTRING macro is going away in the new ruby. Ran into > > that recently. > > Yup. The version I committed to trunk uses the 1.9-compatible > RSTRING_{PTR,LEN} macros > > > > * Your inner loop isn't that readable and too clever. The original > > for loop is clear, and should have the same or more speed when > > handed to a modern compiler. Since you either already know the length > > of the target string, or it's a ruby string that ends in \0, just use a > > regular pointer loop to go through the string. No point starting at > > the back and decrementing a counter that also increment other pointers. > > Additionally, the compiler should make it faster with pointers directly > > instead and there's CPU operations that do this natively anyway, but > > nothing using the non-standard backward-increment-forward-dual-pointers > > thing you have. > > I actually shortened the one committed to trunk a bit (but used nested > ternary operators, so I may rewrite that for better readability). > > It modifies flen directly instead of copying it to a temporary variable. > I don't think Ragel actually terminates field with '\0', but I'll double > check later. > > > > * After your memcpy you don't clamp the string with a \0 since you're > > relying on the backwards loop to do it. This is kind of too clever to > > be useful, so I'd do it the regular way and memcpy then set '\0'. > > That's also safer. > > rb_str_new() actually does it, the loop shouldn't overwrite it. But I > understand if you want me to clamp it again manually for easier > auditing. > > > > * You > > should also double check the code in ruby to make sure that > > any other RString internals don't need to be updated. I believe > > there's a few other things that have to be touched to keep ruby sane > > for some operations. Look at how the ruby dup operations are done. > > * You should get some real HTTP test samples, the worse the better. > > All you've done is shown that it's marginally faster for a single run > > of a simple set of headers. I'd validate other combinations before > > putting in code this complex for just a small boost like that. > > * Also, now that I think about it, if you don't care that the original > > string is modified in place then you can just have ragel do all of this > > as it goes. Simply modify the parser to have it do this transform on > > the header chars using the existing pointer. That'd probably be > > alright since people don't usually keep the input headers around when > > using the mongrel parser. > > I'll look into all of those three. I think I saw rb_str_modify() but > either forgot to use it or figured I didn't need it :X > > > > Give those suggestions a try and see what you get. Thanks for helping > > out Eric. > > Thanks for the feedback, Zed. > > There's also something else that occured to me is why we always create a > new RString object in the first place if it's getting set into a Hash > (and frozen). I suspect we'll get a much bigger performance increase by > avoiding redundant object creation when we get common header names and > directly using global objects to represent them (like global_http_host). > > > Additionally, my understanding is that frozen objects never get GC-ed, > and since strings get frozen when being put into a hash, this could > be a memory leak if somebody unleashes a random header generator. > > Maybe we should keep a global store of predefined HTTP headers we always > accept (all those mentioned in HTTP RFCs), and leave 100 or so slots > open for some random headers clients may put in; > letting those weird clients fill those slots on a first-come basis. > > Afterwards, any new headers we haven't seen and don't know about would > either raise an exception or get silently dropped ... > > This would prevent memory leaks if my understanding of frozen objects > is correct... > > > Way past my bedtime to test these things now, though. > > > > -- > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From normalperson at yhbt.net Sun Mar 2 17:35:19 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sun, 2 Mar 2008 14:35:19 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> Message-ID: <20080302223519.GB13979@hand.yhbt.net> Evan Weaver wrote: > > This would prevent memory leaks if my understanding of frozen objects > > is correct... > > I don't think the GC treats frozen objects in any special way. Oops, it was symbols that leaked, not frozen objects in general. Phew. -- Eric Wong From normalperson at yhbt.net Thu Mar 6 02:54:21 2008 From: normalperson at yhbt.net (Eric Wong) Date: Wed, 5 Mar 2008 23:54:21 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080302123712.GA13979@hand.yhbt.net> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> Message-ID: <20080306075421.GA1583@hand.yhbt.net> Eric Wong wrote: > "Zed A. Shaw" wrote: > > On Thu, 28 Feb 2008 17:53:09 -0800 > > Eric Wong wrote: > > * You > > should also double check the code in ruby to make sure that > > any other RString internals don't need to be updated. I believe > > there's a few other things that have to be touched to keep ruby sane > > for some operations. Look at how the ruby dup operations are done. rb_str_modify() only needs to be called for duplicated strings. For new strings, it's safe to write directly to the pointer after rb_str_new(0, len) is called (the 1.8.6.111 source has several examples of this). > > * You should get some real HTTP test samples, the worse the better. > > All you've done is shown that it's marginally faster for a single run > > of a simple set of headers. I'd validate other combinations before > > putting in code this complex for just a small boost like that. I still need to get to that Friday or this weekend and test with Rfuzz, too. I've added some more unit tests to ensure my code works for now. r992 is a fairly big change (with pretty good benefits, see below), but I've coded that in as fool-proof a way as I possibly could. > > * Also, now that I think about it, if you don't care that the original > > string is modified in place then you can just have ragel do all of this > > as it goes. Simply modify the parser to have it do this transform on > > the header chars using the existing pointer. That'd probably be > > alright since people don't usually keep the input headers around when > > using the mongrel parser. done in r990 > I'll look into all of those three. I think I saw rb_str_modify() but > either forgot to use it or figured I didn't need it :X > > > Give those suggestions a try and see what you get. Thanks for helping > > out Eric. > > Thanks for the feedback, Zed. > > There's also something else that occured to me is why we always create a > new RString object in the first place if it's getting set into a Hash > (and frozen). I suspect we'll get a much bigger performance increase by > avoiding redundant object creation when we get common header names and > directly using global objects to represent them (like global_http_host). I'm getting an even bigger (~22%) performance improvement by predefining some common HTTP headers as global frozen strings upfront (r992) > Additionally, my understanding is that frozen objects never get GC-ed, > and since strings get frozen when being put into a hash, this could > be a memory leak if somebody unleashes a random header generator. Thankfully, I was wrong about frozen strings :) -- Eric Wong From ry at tinyclouds.org Thu Mar 6 04:53:34 2008 From: ry at tinyclouds.org (ry dahl) Date: Thu, 6 Mar 2008 10:53:34 +0100 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080306075421.GA1583@hand.yhbt.net> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> Message-ID: <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> Hi Eric, > I'm getting an even bigger (~22%) performance > improvement by predefining > some common HTTP headers as global frozen > strings upfront (r992) Why don't you do this in Ragel? It will be faster and you don't need to depend on bsearch. I pull out content-length header in ragel in ebb: http://github.com/ry/ebb/tree/master/src/parser.rl (although there is a bug with this because (content_length | message_header ) needs some priorities set so message_header isn't matching content-length too. should be (content_length >2 | message_header >1 ) or something). Also - the state machine should be upgraded to compile with ragel 6. this basically involves removing %write eof; ry From normalperson at yhbt.net Sat Mar 8 03:12:10 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 8 Mar 2008 00:12:10 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> Message-ID: <20080308081210.GA30702@hand.yhbt.net> ry dahl wrote: > Hi Eric, > > > I'm getting an even bigger (~22%) performance > > improvement by predefining > > some common HTTP headers as global frozen > > strings upfront (r992) > > Why don't you do this in Ragel? It will be faster and you don't need > to depend on bsearch. I pull out content-length header in ragel in > ebb: > http://github.com/ry/ebb/tree/master/src/parser.rl > (although there is a bug with this because (content_length | > message_header ) needs some priorities set so message_header isn't > matching content-length too. should be > (content_length >2 | message_header >1 ) > or something). Then I'd have to define a new C function for every header I wanted to optimize for, and then also point to that function inside the Ragel file for each header. Unless we use something like ERB to generate this code for both Ragel and C, I'm not sure it's worth the effort to go through with all the extra code. Currently, with my C/CPP code, I can add or remove headers to memoize strings for by adding or removing one line per header in the C file. Pretty much as easy as it gets maintenance-wise. > Also - the state machine should be upgraded to compile with ragel 6. > this basically involves removing %write eof; Yes. At the same time, I'm not sure if I should force every other developer to upgrade... Evan? Zed? -- Eric Wong From evan at cloudbur.st Sat Mar 8 03:14:40 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 8 Mar 2008 03:14:40 -0500 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080308081210.GA30702@hand.yhbt.net> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> Message-ID: Upgrading ragel is fine with me. Evan On Sat, Mar 8, 2008 at 3:12 AM, Eric Wong wrote: > ry dahl wrote: > > > Hi Eric, > > > > > I'm getting an even bigger (~22%) performance > > > improvement by predefining > > > some common HTTP headers as global frozen > > > strings upfront (r992) > > > > Why don't you do this in Ragel? It will be faster and you don't need > > to depend on bsearch. I pull out content-length header in ragel in > > ebb: > > http://github.com/ry/ebb/tree/master/src/parser.rl > > (although there is a bug with this because (content_length | > > message_header ) needs some priorities set so message_header isn't > > matching content-length too. should be > > (content_length >2 | message_header >1 ) > > or something). > > Then I'd have to define a new C function for every header I wanted to > optimize for, and then also point to that function inside the Ragel file > for each header. > > Unless we use something like ERB to generate this code for both Ragel > and C, I'm not sure it's worth the effort to go through with all the > extra code. > > Currently, with my C/CPP code, I can add or remove headers to memoize > strings for by adding or removing one line per header in the C file. > Pretty much as easy as it gets maintenance-wise. > > > > Also - the state machine should be upgraded to compile with ragel 6. > > this basically involves removing %write eof; > > Yes. At the same time, I'm not sure if I should force every other > developer to upgrade... Evan? Zed? > > -- > Eric Wong > > > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 8 07:37:53 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 8 Mar 2008 10:37:53 -0200 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080308081210.GA30702@hand.yhbt.net> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> Message-ID: <71166b3b0803080437w2809929ajc5bf9ec022c1512c@mail.gmail.com> On Sat, Mar 8, 2008 at 6:12 AM, Eric Wong wrote: > > Unless we use something like ERB to generate this code for both Ragel > and C, I'm not sure it's worth the effort to go through with all the > extra code. > I think is not worth the effort, and also add complexity to the code generation, which should be the simpler as possible. > Yes. At the same time, I'm not sure if I should force every other > developer to upgrade... Evan? Zed? Well, the Ragel compilation is not run every time, but only when the parser get updated, so I can say will be fine the most common cases (developers playing with mongrel code already handle the ragel compiled code). -- Luis Lavena Multimedia systems - A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. Douglas Adams From ry at tinyclouds.org Sat Mar 8 12:37:53 2008 From: ry at tinyclouds.org (ry dahl) Date: Sat, 8 Mar 2008 18:37:53 +0100 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080308081210.GA30702@hand.yhbt.net> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> Message-ID: <3ae7f4480803080937y20b729e0vb9b549cb8184118f@mail.gmail.com> > Then I'd have to define a new C function for every header I wanted to > optimize for, and then also point to that function inside the Ragel file > for each header. Nah, you can just define enum header_types { MONGREL_CONTENT_LENGTH, MONGREL_CONTENT_TYPE, etc } and define a single callback to handle them void (*field_cb)(http_parser*, int header_type, char *at, int len) ry From normalperson at yhbt.net Sat Mar 8 17:02:20 2008 From: normalperson at yhbt.net (Eric Wong) Date: Sat, 8 Mar 2008 14:02:20 -0800 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> Message-ID: <20080308220220.GA27749@mayonaise> Evan Weaver wrote: > Upgrading ragel is fine with me. Here's my work-in-progress. The changes below are pretty much copied from ry's changes in ebb. I haven't been able to figure out why test_horrible_queries(HttpParserTest) is failing, so any help here would be appreciated. Thanks. diff --git a/Rakefile b/Rakefile index f47d7a2..07a89c2 100644 --- a/Rakefile +++ b/Rakefile @@ -55,13 +55,15 @@ task :ragel do Dir.chdir "ext/http11" do target = "http11_parser.c" File.unlink target if File.exist? target - sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" + # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" # ragel 5.x + sh "ragel -G2 http11_parser.rl" # ragel 6.0 raise "Failed to build C source" unless File.exist? target end Dir.chdir "ext/http11" do target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" File.unlink target if File.exist? target - sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" + # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" # ragel 5.x + sh "ragel -J -o #{target} http11_parser.java.rl" # ragel 6.0 raise "Failed to build Java source" unless File.exist? target end end diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl index a418605..0c4e2d4 100644 --- a/ext/http11/http11_parser.rl +++ b/ext/http11/http11_parser.rl @@ -114,7 +114,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, p = buffer+off; pe = buffer+len; - assert(*pe == '\0' && "pointer does not end on NUL"); + /* assert(*pe == '\0' && "pointer does not end on NUL"); */ assert(pe - p == len - off && "pointers aren't same distance"); @@ -130,23 +130,11 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, assert(parser->field_len <= len && "field has length longer than whole buffer"); assert(parser->field_start < len && "field starts after buffer end"); - if(parser->body_start) { - /* final \r\n combo encountered so stop right here */ - %%write eof; - parser->nread++; - } - return(parser->nread); } int http_parser_finish(http_parser *parser) { - int cs = parser->cs; - - %%write eof; - - parser->cs = cs; - if (http_parser_has_error(parser) ) { return -1; } else if (http_parser_is_finished(parser) ) { @@ -161,5 +149,5 @@ int http_parser_has_error(http_parser *parser) { } int http_parser_is_finished(http_parser *parser) { - return parser->cs == http_parser_first_final; + return parser->cs >= http_parser_first_final; } -- Eric Wong From evan at cloudbur.st Mon Mar 24 14:39:05 2008 From: evan at cloudbur.st (Evan Weaver) Date: Mon, 24 Mar 2008 14:39:05 -0400 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080308220220.GA27749@mayonaise> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> <20080308220220.GA27749@mayonaise> Message-ID: Hi all, I backported the trunk parser changes and applied the Ragel fix to branches/stable_1-2 . Two tests are currently failing... could someone (Eric, Ry?) take a look at these? I am not good enough with Ragel to be able to say whether or not the eof change is related to the test failures. Thanks, Evan On Sat, Mar 8, 2008 at 6:02 PM, Eric Wong wrote: > Evan Weaver wrote: > > > Upgrading ragel is fine with me. > > Here's my work-in-progress. The changes below are pretty much copied > from ry's changes in ebb. > > I haven't been able to figure out why > test_horrible_queries(HttpParserTest) is failing, so any help here would > be appreciated. > > Thanks. > > diff --git a/Rakefile b/Rakefile > index f47d7a2..07a89c2 100644 > --- a/Rakefile > +++ b/Rakefile > @@ -55,13 +55,15 @@ task :ragel do > Dir.chdir "ext/http11" do > target = "http11_parser.c" > File.unlink target if File.exist? target > - sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" > + # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" # ragel 5.x > + sh "ragel -G2 http11_parser.rl" # ragel 6.0 > raise "Failed to build C source" unless File.exist? target > end > Dir.chdir "ext/http11" do > target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" > File.unlink target if File.exist? target > - sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" > + # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" # ragel 5.x > + sh "ragel -J -o #{target} http11_parser.java.rl" # ragel 6.0 > raise "Failed to build Java source" unless File.exist? target > end > end > diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl > index a418605..0c4e2d4 100644 > --- a/ext/http11/http11_parser.rl > +++ b/ext/http11/http11_parser.rl > @@ -114,7 +114,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > p = buffer+off; > pe = buffer+len; > > - assert(*pe == '\0' && "pointer does not end on NUL"); > + /* assert(*pe == '\0' && "pointer does not end on NUL"); */ > assert(pe - p == len - off && "pointers aren't same distance"); > > > @@ -130,23 +130,11 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > assert(parser->field_len <= len && "field has length longer than whole buffer"); > assert(parser->field_start < len && "field starts after buffer end"); > > - if(parser->body_start) { > - /* final \r\n combo encountered so stop right here */ > - %%write eof; > - parser->nread++; > - } > - > return(parser->nread); > } > > int http_parser_finish(http_parser *parser) > { > - int cs = parser->cs; > - > - %%write eof; > - > - parser->cs = cs; > - > if (http_parser_has_error(parser) ) { > return -1; > } else if (http_parser_is_finished(parser) ) { > @@ -161,5 +149,5 @@ int http_parser_has_error(http_parser *parser) { > } > > int http_parser_is_finished(http_parser *parser) { > - return parser->cs == http_parser_first_final; > + return parser->cs >= http_parser_first_final; > } > -- > > > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From normalperson at yhbt.net Mon Mar 24 23:43:07 2008 From: normalperson at yhbt.net (Eric Wong) Date: Mon, 24 Mar 2008 20:43:07 -0700 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> <20080308220220.GA27749@mayonaise> Message-ID: <20080325034307.GA13379@soma> Evan Weaver wrote: > Hi all, > > I backported the trunk parser changes and applied the Ragel fix to > branches/stable_1-2 . Two tests are currently failing... could someone > (Eric, Ry?) take a look at these? I am not good enough with Ragel to > be able to say whether or not the eof change is related to the test > failures. Hi Evan, I never committed the Ragel 6 upgrade to trunk because I couldn't figure out why it was broken. I was hoping someone else would step in and fix it for us :) Reverting my attempt at upgrading to Ragel 6 fixes one test... As for the other test that fails, you uncommented the nasty_pound_header test in the commit for multi-line. This test doesn't work in stable-1_1 nor trunk, and I've never made any effort into getting it working (nor was it my fault it's broken in the first place :) Digging into the revision history (with git :), the nasty_pound_header test was committed in its commented form in r361 and has never changed until now. The Mongrel HTTP parser code does not appear to handle multi-line HTTP headers at all, so I'm not surprised that test fails. I would suggest disabling the nasty_pound_header test again until we can successfully parse multi-line headers. > Thanks, > > Evan > > On Sat, Mar 8, 2008 at 6:02 PM, Eric Wong wrote: > > Evan Weaver wrote: > > > > > Upgrading ragel is fine with me. > > > > Here's my work-in-progress. The changes below are pretty much copied > > from ry's changes in ebb. > > > > I haven't been able to figure out why > > test_horrible_queries(HttpParserTest) is failing, so any help here would > > be appreciated. > > > > Thanks. > > > > diff --git a/Rakefile b/Rakefile > > index f47d7a2..07a89c2 100644 > > --- a/Rakefile > > +++ b/Rakefile > > @@ -55,13 +55,15 @@ task :ragel do > > Dir.chdir "ext/http11" do > > target = "http11_parser.c" > > File.unlink target if File.exist? target > > - sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" > > + # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" # ragel 5.x > > + sh "ragel -G2 http11_parser.rl" # ragel 6.0 > > raise "Failed to build C source" unless File.exist? target > > end > > Dir.chdir "ext/http11" do > > target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" > > File.unlink target if File.exist? target > > - sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" > > + # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" # ragel 5.x > > + sh "ragel -J -o #{target} http11_parser.java.rl" # ragel 6.0 > > raise "Failed to build Java source" unless File.exist? target > > end > > end > > diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl > > index a418605..0c4e2d4 100644 > > --- a/ext/http11/http11_parser.rl > > +++ b/ext/http11/http11_parser.rl > > @@ -114,7 +114,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > > p = buffer+off; > > pe = buffer+len; > > > > - assert(*pe == '\0' && "pointer does not end on NUL"); > > + /* assert(*pe == '\0' && "pointer does not end on NUL"); */ > > assert(pe - p == len - off && "pointers aren't same distance"); > > > > > > @@ -130,23 +130,11 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > > assert(parser->field_len <= len && "field has length longer than whole buffer"); > > assert(parser->field_start < len && "field starts after buffer end"); > > > > - if(parser->body_start) { > > - /* final \r\n combo encountered so stop right here */ > > - %%write eof; > > - parser->nread++; > > - } > > - > > return(parser->nread); > > } > > > > int http_parser_finish(http_parser *parser) > > { > > - int cs = parser->cs; > > - > > - %%write eof; > > - > > - parser->cs = cs; > > - > > if (http_parser_has_error(parser) ) { > > return -1; > > } else if (http_parser_is_finished(parser) ) { > > @@ -161,5 +149,5 @@ int http_parser_has_error(http_parser *parser) { > > } > > > > int http_parser_is_finished(http_parser *parser) { > > - return parser->cs == http_parser_first_final; > > + return parser->cs >= http_parser_first_final; > > } > > -- > > > > > > Eric Wong > -- > Evan Weaver > Cloudburst, LLC From evan at cloudbur.st Tue Mar 25 00:53:16 2008 From: evan at cloudbur.st (Evan Weaver) Date: Tue, 25 Mar 2008 00:53:16 -0400 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: <20080325034307.GA13379@soma> References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> <20080308220220.GA27749@mayonaise> <20080325034307.GA13379@soma> Message-ID: > I never committed the Ragel 6 upgrade to trunk because I couldn't figure > out why it was broken. I was hoping someone else would step in and fix > it for us :) Maybe Ry knows. Otherwise, I'll try to hack through it. I think something might have to happen in the state transitions to make up for the inability to explicitly close the output (is that even remotely close?). > Digging into the revision history (with git :), the nasty_pound_header > test was committed in its commented form in r361 and has never changed > until now. I'm not surprised, but there was no comment as to why it was disabled, so I enabled it and let it fail. We should maybe remove that test entirely and document multiline headers as not supported. Thanks for looking in to this. Evan > > > > On Sat, Mar 8, 2008 at 6:02 PM, Eric Wong wrote: > > > Evan Weaver wrote: > > > > > > > Upgrading ragel is fine with me. > > > > > > Here's my work-in-progress. The changes below are pretty much copied > > > from ry's changes in ebb. > > > > > > I haven't been able to figure out why > > > test_horrible_queries(HttpParserTest) is failing, so any help here would > > > be appreciated. > > > > > > Thanks. > > > > > > diff --git a/Rakefile b/Rakefile > > > index f47d7a2..07a89c2 100644 > > > --- a/Rakefile > > > +++ b/Rakefile > > > @@ -55,13 +55,15 @@ task :ragel do > > > Dir.chdir "ext/http11" do > > > target = "http11_parser.c" > > > File.unlink target if File.exist? target > > > - sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" > > > + # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" # ragel 5.x > > > + sh "ragel -G2 http11_parser.rl" # ragel 6.0 > > > raise "Failed to build C source" unless File.exist? target > > > end > > > Dir.chdir "ext/http11" do > > > target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" > > > File.unlink target if File.exist? target > > > - sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" > > > + # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" # ragel 5.x > > > + sh "ragel -J -o #{target} http11_parser.java.rl" # ragel 6.0 > > > raise "Failed to build Java source" unless File.exist? target > > > end > > > end > > > diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl > > > index a418605..0c4e2d4 100644 > > > --- a/ext/http11/http11_parser.rl > > > +++ b/ext/http11/http11_parser.rl > > > @@ -114,7 +114,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > > > p = buffer+off; > > > pe = buffer+len; > > > > > > - assert(*pe == '\0' && "pointer does not end on NUL"); > > > + /* assert(*pe == '\0' && "pointer does not end on NUL"); */ > > > assert(pe - p == len - off && "pointers aren't same distance"); > > > > > > > > > @@ -130,23 +130,11 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > > > assert(parser->field_len <= len && "field has length longer than whole buffer"); > > > assert(parser->field_start < len && "field starts after buffer end"); > > > > > > - if(parser->body_start) { > > > - /* final \r\n combo encountered so stop right here */ > > > - %%write eof; > > > - parser->nread++; > > > - } > > > - > > > return(parser->nread); > > > } > > > > > > int http_parser_finish(http_parser *parser) > > > { > > > - int cs = parser->cs; > > > - > > > - %%write eof; > > > - > > > - parser->cs = cs; > > > - > > > if (http_parser_has_error(parser) ) { > > > return -1; > > > } else if (http_parser_is_finished(parser) ) { > > > @@ -161,5 +149,5 @@ int http_parser_has_error(http_parser *parser) { > > > } > > > > > > int http_parser_is_finished(http_parser *parser) { > > > - return parser->cs == http_parser_first_final; > > > + return parser->cs >= http_parser_first_final; > > > } > > > -- > > > > > > > > > Eric Wong > > -- > > Evan Weaver > > Cloudburst, LLC > > > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From ry at tinyclouds.org Tue Mar 25 04:13:24 2008 From: ry at tinyclouds.org (ry dahl) Date: Tue, 25 Mar 2008 09:13:24 +0100 Subject: [Mongrel-development] [PATCH] http11: ~6% performance increase in header parsing In-Reply-To: References: <20080229015309.GA9080@untitled> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> <20080308220220.GA27749@mayonaise> <20080325034307.GA13379@soma> Message-ID: <3ae7f4480803250113m4aefb748o308e841cb2abec7e@mail.gmail.com> This is broken in Ebb too. I'll put some time into it again today and see if I can fix it. ry On Tue, Mar 25, 2008 at 5:53 AM, Evan Weaver wrote: > > I never committed the Ragel 6 upgrade to trunk because I couldn't figure > > out why it was broken. I was hoping someone else would step in and fix > > it for us :) > > Maybe Ry knows. Otherwise, I'll try to hack through it. I think > something might have to happen in the state transitions to make up for > the inability to explicitly close the output (is that even remotely > close?). > > > > Digging into the revision history (with git :), the nasty_pound_header > > test was committed in its commented form in r361 and has never changed > > until now. > > I'm not surprised, but there was no comment as to why it was disabled, > so I enabled it and let it fail. We should maybe remove that test > entirely and document multiline headers as not supported. > > Thanks for looking in to this. > > > > Evan > > > > > > > > > On Sat, Mar 8, 2008 at 6:02 PM, Eric Wong wrote: > > > > Evan Weaver wrote: > > > > > > > > > Upgrading ragel is fine with me. > > > > > > > > Here's my work-in-progress. The changes below are pretty much copied > > > > from ry's changes in ebb. > > > > > > > > I haven't been able to figure out why > > > > test_horrible_queries(HttpParserTest) is failing, so any help here would > > > > be appreciated. > > > > > > > > Thanks. > > > > > > > > diff --git a/Rakefile b/Rakefile > > > > index f47d7a2..07a89c2 100644 > > > > --- a/Rakefile > > > > +++ b/Rakefile > > > > @@ -55,13 +55,15 @@ task :ragel do > > > > Dir.chdir "ext/http11" do > > > > target = "http11_parser.c" > > > > File.unlink target if File.exist? target > > > > - sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" > > > > + # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" # ragel 5.x > > > > + sh "ragel -G2 http11_parser.rl" # ragel 6.0 > > > > raise "Failed to build C source" unless File.exist? target > > > > end > > > > Dir.chdir "ext/http11" do > > > > target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" > > > > File.unlink target if File.exist? target > > > > - sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" > > > > + # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" # ragel 5.x > > > > + sh "ragel -J -o #{target} http11_parser.java.rl" # ragel 6.0 > > > > raise "Failed to build Java source" unless File.exist? target > > > > end > > > > end > > > > diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl > > > > index a418605..0c4e2d4 100644 > > > > --- a/ext/http11/http11_parser.rl > > > > +++ b/ext/http11/http11_parser.rl > > > > @@ -114,7 +114,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > > > > p = buffer+off; > > > > pe = buffer+len; > > > > > > > > - assert(*pe == '\0' && "pointer does not end on NUL"); > > > > + /* assert(*pe == '\0' && "pointer does not end on NUL"); */ > > > > assert(pe - p == len - off && "pointers aren't same distance"); > > > > > > > > > > > > @@ -130,23 +130,11 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > > > > assert(parser->field_len <= len && "field has length longer than whole buffer"); > > > > assert(parser->field_start < len && "field starts after buffer end"); > > > > > > > > - if(parser->body_start) { > > > > - /* final \r\n combo encountered so stop right here */ > > > > - %%write eof; > > > > - parser->nread++; > > > > - } > > > > - > > > > return(parser->nread); > > > > } > > > > > > > > int http_parser_finish(http_parser *parser) > > > > { > > > > - int cs = parser->cs; > > > > - > > > > - %%write eof; > > > > - > > > > - parser->cs = cs; > > > > - > > > > if (http_parser_has_error(parser) ) { > > > > return -1; > > > > } else if (http_parser_is_finished(parser) ) { > > > > @@ -161,5 +149,5 @@ int http_parser_has_error(http_parser *parser) { > > > > } > > > > > > > > int http_parser_is_finished(http_parser *parser) { > > > > - return parser->cs == http_parser_first_final; > > > > + return parser->cs >= http_parser_first_final; > > > > } > > > > -- > > > > > > > > > > > > Eric Wong > > > -- > > > Evan Weaver > > > Cloudburst, LLC > > > > > > _______________________________________________ > > Mongrel-development mailing list > > Mongrel-development at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-development > > > > > > -- > Evan Weaver > Cloudburst, LLC > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > From luislavena at gmail.com Sat Mar 29 09:24:45 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 10:24:45 -0300 Subject: [Mongrel-development] Can no longer checkout svn as anonymous Message-ID: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> Hello guys, After the move to Trac, my CI can no longer checkout from the repository. Been using the http path stated here: http://rubyforge.org/scm/?group_id=1306 using this command: svn checkout http://mongrel.rubyforge.org/svn/ which no longer works, since mongrel.rubyforge now resolves to the trac instance. Any workaround this? Maybe is a Rubyforge thing that RF staff can solve? For the time being, I'm switching to svn:// protocol. Just FYI. -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Sat Mar 29 10:59:01 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 29 Mar 2008 10:59:01 -0400 Subject: [Mongrel-development] Can no longer checkout svn as anonymous In-Reply-To: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> References: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> Message-ID: svn:// works, or you can point mongrel.rubyforge.org to the Rubyforge.org IP in your /etc/hosts file. If there's some Apache rewrite I can add so that that URL still gets forwarded I will do it, but I wasn't quite sure how. Evan On Sat, Mar 29, 2008 at 9:24 AM, Luis Lavena wrote: > Hello guys, > > After the move to Trac, my CI can no longer checkout from the > repository. Been using the http path stated here: > > http://rubyforge.org/scm/?group_id=1306 > > using this command: > > svn checkout http://mongrel.rubyforge.org/svn/ > > which no longer works, since mongrel.rubyforge now resolves to the > trac instance. > > Any workaround this? Maybe is a Rubyforge thing that RF staff can solve? > > For the time being, I'm switching to svn:// protocol. > > Just FYI. > -- > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 29 11:03:02 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 12:03:02 -0300 Subject: [Mongrel-development] Can no longer checkout svn as anonymous In-Reply-To: References: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> Message-ID: <71166b3b0803290803s792fd3ffk22fa4a9f12f89da4@mail.gmail.com> On Sat, Mar 29, 2008 at 11:59 AM, Evan Weaver wrote: > svn:// works, or you can point mongrel.rubyforge.org to the > Rubyforge.org IP in your /etc/hosts file. > Started to use svn:// for the CI, thank you. > If there's some Apache rewrite I can add so that that URL still gets > forwarded I will do it, but I wasn't quite sure how. > I don't know. Last time I played with apache was in the 90's and with 1.x version I guess. -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Sat Mar 29 11:10:04 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 29 Mar 2008 11:10:04 -0400 Subject: [Mongrel-development] Can no longer checkout svn as anonymous In-Reply-To: <71166b3b0803290803s792fd3ffk22fa4a9f12f89da4@mail.gmail.com> References: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> <71166b3b0803290803s792fd3ffk22fa4a9f12f89da4@mail.gmail.com> Message-ID: I guess I could just try it. I wasn't sure if you could forward to a remote server in a sane way. Evan On Sat, Mar 29, 2008 at 11:03 AM, Luis Lavena wrote: > On Sat, Mar 29, 2008 at 11:59 AM, Evan Weaver wrote: > > svn:// works, or you can point mongrel.rubyforge.org to the > > Rubyforge.org IP in your /etc/hosts file. > > > > Started to use svn:// for the CI, thank you. > > > > If there's some Apache rewrite I can add so that that URL still gets > > forwarded I will do it, but I wasn't quite sure how. > > > > I don't know. Last time I played with apache was in the 90's and with > 1.x version I guess. > > -- > > > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 29 11:15:05 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 12:15:05 -0300 Subject: [Mongrel-development] Can no longer checkout svn as anonymous In-Reply-To: References: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> <71166b3b0803290803s792fd3ffk22fa4a9f12f89da4@mail.gmail.com> Message-ID: <71166b3b0803290815v38b41433oa83a38560ea08769@mail.gmail.com> On Sat, Mar 29, 2008 at 12:10 PM, Evan Weaver wrote: > I guess I could just try it. I wasn't sure if you could forward to a > remote server in a sane way. svn will follow redirects, by default, http://mongrel.rubyforge.org/svn/ was redirecting to itself... (at least that was bzr pulling reported). Regards and thank you, -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Sat Mar 29 11:23:47 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 29 Mar 2008 11:23:47 -0400 Subject: [Mongrel-development] Can no longer checkout svn as anonymous In-Reply-To: <71166b3b0803290815v38b41433oa83a38560ea08769@mail.gmail.com> References: <71166b3b0803290624h4b77a7ffu4a1b3dcc38e8ec94@mail.gmail.com> <71166b3b0803290803s792fd3ffk22fa4a9f12f89da4@mail.gmail.com> <71166b3b0803290815v38b41433oa83a38560ea08769@mail.gmail.com> Message-ID: Rubyforge needs to see the Host: header to know which repository to access, so just a plain 30x isn't good enough. Evan On Sat, Mar 29, 2008 at 11:15 AM, Luis Lavena wrote: > On Sat, Mar 29, 2008 at 12:10 PM, Evan Weaver wrote: > > I guess I could just try it. I wasn't sure if you could forward to a > > remote server in a sane way. > > svn will follow redirects, by default, > http://mongrel.rubyforge.org/svn/ was redirecting to itself... (at > least that was bzr pulling reported). > > Regards and thank you, > -- > > > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 29 17:56:12 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 18:56:12 -0300 Subject: [Mongrel-development] Stats of latest commits Message-ID: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> Hello guys, Looks like latests commits (either to trunk or stable_1-2) broke the build completely (at least, for me). trunk: 996 (normalperson) ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] 61 tests, 494 assertions, 2 failures, 1 errors === 1) Failure: test_base_handler_config(ConfiguratorTest) [./test/test_configurator.rb:82]: <[Errno::EBADF, Errno::ECONNREFUSED]> exception expected but was Class: Message: <"An existing connection was forcibly closed by the remote host."> ---Backtrace--- C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread' C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' C:/Ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' C:/Ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' C:/Ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' C:/Ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil' C:/Ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' C:/Ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line' C:/Ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' C:/Ruby/lib/ruby/1.8/net/http.rb:1059:in `request' C:/Ruby/lib/ruby/1.8/net/http.rb:957:in `request_get' C:/Ruby/lib/ruby/1.8/net/http.rb:380:in `get_response' C:/Ruby/lib/ruby/1.8/net/http.rb:547:in `start' C:/Ruby/lib/ruby/1.8/net/http.rb:379:in `get_response' C:/Ruby/lib/ruby/1.8/net/http.rb:356:in `get' ./test/test_configurator.rb:83:in `test_base_handler_config' ./test/test_configurator.rb:82:in `test_base_handler_config' --------------- 2) Failure: test_horrible_queries(HttpParserTest) [./test/test_http11.rb:221:in `test_horrible_queries' ./test/test_http11.rb:219:in `times' ./test/test_http11.rb:219:in `test_horrible_queries']: exception expected but none was thrown. 3) Error: test_parse_ie6_urls(HttpParserTest): Mongrel::HttpParserError: Invalid HTTP format, parsing fails. ./test/test_http11.rb:67:in `execute' ./test/test_http11.rb:67:in `test_parse_ie6_urls' ./test/test_http11.rb:58:in `each' ./test/test_http11.rb:58:in `test_parse_ie6_urls' === "stable", on the other hand, is doom, pastie follows: http://pastie.caboo.se/172564 Don't know what happened, or maybe it's me :-P regards, -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Sat Mar 29 18:02:31 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 29 Mar 2008 18:02:31 -0400 Subject: [Mongrel-development] Stats of latest commits In-Reply-To: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> References: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> Message-ID: Port already in use? Evan On Sat, Mar 29, 2008 at 5:56 PM, Luis Lavena wrote: > Hello guys, > > Looks like latests commits (either to trunk or stable_1-2) broke the > build completely (at least, for me). > > trunk: 996 (normalperson) > ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] > > 61 tests, 494 assertions, 2 failures, 1 errors > > === > > 1) Failure: > test_base_handler_config(ConfiguratorTest) [./test/test_configurator.rb:82]: > <[Errno::EBADF, Errno::ECONNREFUSED]> exception expected but was > Class: > Message: <"An existing connection was forcibly closed by the remote host."> > ---Backtrace--- > C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' > C:/Ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' > C:/Ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' > C:/Ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line' > C:/Ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' > C:/Ruby/lib/ruby/1.8/net/http.rb:1059:in `request' > C:/Ruby/lib/ruby/1.8/net/http.rb:957:in `request_get' > C:/Ruby/lib/ruby/1.8/net/http.rb:380:in `get_response' > C:/Ruby/lib/ruby/1.8/net/http.rb:547:in `start' > C:/Ruby/lib/ruby/1.8/net/http.rb:379:in `get_response' > C:/Ruby/lib/ruby/1.8/net/http.rb:356:in `get' > ./test/test_configurator.rb:83:in `test_base_handler_config' > ./test/test_configurator.rb:82:in `test_base_handler_config' > --------------- > > 2) Failure: > test_horrible_queries(HttpParserTest) > [./test/test_http11.rb:221:in `test_horrible_queries' > ./test/test_http11.rb:219:in `times' > ./test/test_http11.rb:219:in `test_horrible_queries']: > exception expected but none was thrown. > > 3) Error: > test_parse_ie6_urls(HttpParserTest): > Mongrel::HttpParserError: Invalid HTTP format, parsing fails. > ./test/test_http11.rb:67:in `execute' > ./test/test_http11.rb:67:in `test_parse_ie6_urls' > ./test/test_http11.rb:58:in `each' > ./test/test_http11.rb:58:in `test_parse_ie6_urls' > > === > > "stable", on the other hand, is doom, pastie follows: > > http://pastie.caboo.se/172564 > > > Don't know what happened, or maybe it's me :-P > > regards, > -- > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 29 18:03:24 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 19:03:24 -0300 Subject: [Mongrel-development] Stats of latest commits In-Reply-To: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> References: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> Message-ID: <71166b3b0803291503r6dd6e335o8b98240432d4be5@mail.gmail.com> On Sat, Mar 29, 2008 at 6:56 PM, Luis Lavena wrote: > Hello guys, > > Looks like latests commits (either to trunk or stable_1-2) broke the > build completely (at least, for me). Updated, it seems the sequence of rake tasks matters: rake clobber compile test (trunk) 1) Failure: test_base_handler_config(ConfiguratorTest) [./test/test_configurator.rb:82]: <[Errno::EBADF, Errno::ECONNREFUSED]> exception expected but was Class: Message: <"An existing connection was forcibly closed by the remote host."> ---Backtrace--- C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread' C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' C:/Ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' C:/Ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' C:/Ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' C:/Ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil' C:/Ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' C:/Ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line' C:/Ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' C:/Ruby/lib/ruby/1.8/net/http.rb:1059:in `request' C:/Ruby/lib/ruby/1.8/net/http.rb:957:in `request_get' C:/Ruby/lib/ruby/1.8/net/http.rb:380:in `get_response' C:/Ruby/lib/ruby/1.8/net/http.rb:547:in `start' C:/Ruby/lib/ruby/1.8/net/http.rb:379:in `get_response' C:/Ruby/lib/ruby/1.8/net/http.rb:356:in `get' ./test/test_configurator.rb:83:in `test_base_handler_config' ./test/test_configurator.rb:82:in `test_base_handler_config' --------------- 61 tests, 541 assertions, 1 failures, 0 errors === stable_1-2, on the other hand, still highly broken: 59 tests, 416 assertions, 2 failures, 35 errors -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Sat Mar 29 18:06:23 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 29 Mar 2008 18:06:23 -0400 Subject: [Mongrel-development] Stats of latest commits In-Reply-To: <71166b3b0803291503r6dd6e335o8b98240432d4be5@mail.gmail.com> References: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> <71166b3b0803291503r6dd6e335o8b98240432d4be5@mail.gmail.com> Message-ID: Can you try binary searching stable to see when it broke? (Probably 995 though.) Evan On Sat, Mar 29, 2008 at 6:03 PM, Luis Lavena wrote: > On Sat, Mar 29, 2008 at 6:56 PM, Luis Lavena wrote: > > > Hello guys, > > > > Looks like latests commits (either to trunk or stable_1-2) broke the > > build completely (at least, for me). > > > Updated, it seems the sequence of rake tasks matters: > > rake clobber compile test > (trunk) > > > 1) Failure: > test_base_handler_config(ConfiguratorTest) [./test/test_configurator.rb:82]: > <[Errno::EBADF, Errno::ECONNREFUSED]> exception expected but was > Class: > Message: <"An existing connection was forcibly closed by the remote host."> > ---Backtrace--- > C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' > C:/Ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' > C:/Ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil' > C:/Ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' > C:/Ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line' > C:/Ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' > C:/Ruby/lib/ruby/1.8/net/http.rb:1059:in `request' > C:/Ruby/lib/ruby/1.8/net/http.rb:957:in `request_get' > C:/Ruby/lib/ruby/1.8/net/http.rb:380:in `get_response' > C:/Ruby/lib/ruby/1.8/net/http.rb:547:in `start' > C:/Ruby/lib/ruby/1.8/net/http.rb:379:in `get_response' > C:/Ruby/lib/ruby/1.8/net/http.rb:356:in `get' > ./test/test_configurator.rb:83:in `test_base_handler_config' > ./test/test_configurator.rb:82:in `test_base_handler_config' > --------------- > > 61 tests, 541 assertions, 1 failures, 0 errors > > === > > stable_1-2, on the other hand, still highly broken: > > 59 tests, 416 assertions, 2 failures, 35 errors > > > > -- > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 29 18:07:02 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 19:07:02 -0300 Subject: [Mongrel-development] Stats of latest commits In-Reply-To: References: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> Message-ID: <71166b3b0803291507q6f40848cnda017bec2861c0cf@mail.gmail.com> On Sat, Mar 29, 2008 at 7:02 PM, Evan Weaver wrote: > Port already in use? > Yep, looks like one test isn't teardown properly, but that only happens on stable branch, not in trunk (on trunk only one failure remains). It seems the merge didn't happen properly? (or something is missing). -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Sat Mar 29 18:12:27 2008 From: evan at cloudbur.st (Evan Weaver) Date: Sat, 29 Mar 2008 18:12:27 -0400 Subject: [Mongrel-development] Stats of latest commits In-Reply-To: <71166b3b0803291507q6f40848cnda017bec2861c0cf@mail.gmail.com> References: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> <71166b3b0803291507q6f40848cnda017bec2861c0cf@mail.gmail.com> Message-ID: It is possible that I just plain broke it--maybe related to the order of the tests, which could be different for you than for me. Try reverting the change around the method mentioned in http://mongrel.rubyforge.org/ticket/19 . The solution in the ticket didn't really make sense and I need someone else to verify my change. Evan On Sat, Mar 29, 2008 at 6:07 PM, Luis Lavena wrote: > On Sat, Mar 29, 2008 at 7:02 PM, Evan Weaver wrote: > > Port already in use? > > > > Yep, looks like one test isn't teardown properly, but that only > happens on stable branch, not in trunk (on trunk only one failure > remains). > > It seems the merge didn't happen properly? (or something is missing). > > -- > > > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Sat Mar 29 18:15:37 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 29 Mar 2008 19:15:37 -0300 Subject: [Mongrel-development] Stats of latest commits In-Reply-To: References: <71166b3b0803291456j3e40b6a3oe796400ef8e83bc3@mail.gmail.com> <71166b3b0803291507q6f40848cnda017bec2861c0cf@mail.gmail.com> Message-ID: <71166b3b0803291515v5b197286n7bffa838c88eeab1@mail.gmail.com> On Sat, Mar 29, 2008 at 7:12 PM, Evan Weaver wrote: > It is possible that I just plain broke it--maybe related to the order > of the tests, which could be different for you than for me. > > Try reverting the change around the method mentioned in > http://mongrel.rubyforge.org/ticket/19 . The solution in the ticket > didn't really make sense and I need someone else to verify my change. > Can you try this in latest version? ruby -Ilib;ext;bin;test "C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/test_helper.rb" "test/unit/test_cgi_wrapper.rb" "test/unit/test_command.rb" "test/unit/test_conditional.rb" "test/unit/test_configurator.rb" "test/unit/test_debug.rb" "test/unit/test_handlers.rb" "test/unit/test_http_parser.rb" "test/unit/test_redirect_handler.rb" "test/unit/test_request_progress.rb" "test/unit/test_response.rb" "test/unit/test_stats.rb" "test/unit/test_uriclassifier.rb" "test/unit/test_ws.rb" (only change the rake_test_loader.rb location). -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From builder at mmediasys.com Sun Mar 30 14:03:27 2008 From: builder at mmediasys.com (builder at mmediasys.com) Date: Sun, 30 Mar 2008 15:03:27 -0300 Subject: [Mongrel-development] [CruiseControl] mongrel-trunk-mswin32 build 996 failed Message-ID: <47efd5ef6ab08_c4813de3a61a6@KEORE.tmail> The build failed. Note: if you set Configuration.dashboard_url in config/site_config.rb, you'd see a link to the build page here. CHANGES ------- This is the first build BUILD LOG --------- D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" rake aborted! Could not find RubyGem echoe (>= 2.7.5) D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work/rakefile:3 (See full trace by running task with --trace) (in D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work) dir : D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work command : ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" executed command : echo D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/build-996/build.log && ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:\Users\Luis\.cruise\projects\mongrel-trunk-mswin32\build-996\build.log 2>&1 exitstatus: 1 STDERR TAIL START STDERR TAIL END PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ['mongrel-development at rubyforge.org', 'rubyinstaller-devel at rubyforge.org'] project.rake_task = 'clobber compile test' project.scheduler.polling_interval = 5.minutes end From builder at mmediasys.com Sun Mar 30 14:16:23 2008 From: builder at mmediasys.com (builder at mmediasys.com) Date: Sun, 30 Mar 2008 15:16:23 -0300 Subject: [Mongrel-development] [CruiseControl] mongrel-trunk-mswin32 build 997 failed Message-ID: <47efd8f798968_d5013de3a6164@KEORE.tmail> The build failed. Note: if you set Configuration.dashboard_url in config/site_config.rb, you'd see a link to the build page here. CHANGES ------- New revision 997 detected Revision 997 committed by luislavena on 2008-03-30 18:11:47 Remove deprecated WIN32 and use Gem::Platform::CURRENT instead. M /trunk M /trunk/Rakefile BUILD LOG --------- D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" C:/Ruby/bin/ruby extconf.rb (in D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work) [CruiseControl] Invoking Rake task "clobber" Cleaning - ext/http11/http11-i386-mswin32.def - ext/http11/http11-i386-mswin32.exp - ext/http11/http11-i386-mswin32.lib - ext/http11/http11-i386-mswin32.pdb - ext/http11/http11.obj - ext/http11/http11_parser.obj - ext/http11/Makefile - ext/http11/vc60.pdb - lib/http11.so [CruiseControl] Invoking Rake task "compile" checking for main() in c.lib... no creating Makefile Microsoft (R) Program Maintenance Utility Version 6.00.9782.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. C:\Ruby\bin\ruby -e "puts 'EXPORTS', 'Init_http11'" > http11-i386-mswin32.def cl -nologo -I. -I. -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tchttp11.c http11.c cl -nologo -I. -I. -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tchttp11_parser.c http11_parser.c cl -nologo -LD -Fehttp11.so http11.obj http11_parser.obj msvcrt-ruby18.lib oldnames.lib user32.lib advapi32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -dll -libpath:"." -libpath:"C:/Ruby/lib" -def:http11-i386-mswin32.def -implib:http11-i386-mswin32.lib -pdb:http11-i386-mswin32.pdb Creating library http11-i386-mswin32.lib and object http11-i386-mswin32.exp C:/Ruby/bin/ruby -Ilib;ext;bin;test "C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/test_cgi_wrapper.rb" "test/test_command.rb" "test/test_conditional.rb" "test/test_configurator.rb" "test/test_debug.rb" "test/test_handlers.rb" "test/test_http11.rb" "test/test_redirect_handler.rb" "test/test_request_progress.rb" "test/test_response.rb" "test/test_stats.rb" "test/test_uriclassifier.rb" "test/test_ws.rb" [CruiseControl] Invoking Rake task "test" Loaded suite C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader Started ...............F............................................. Finished in 30.797 seconds. 1) Failure: test_base_handler_config(ConfiguratorTest) [./test/test_configurator.rb:82]: <[Errno::EBADF, Errno::ECONNREFUSED]> exception expected but was Class: Message: <"An existing connection was forcibly closed by the remote host."> ---Backtrace--- C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `sysread' C:/Ruby/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' C:/Ruby/lib/ruby/1.8/timeout.rb:56:in `timeout' C:/Ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' C:/Ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill' C:/Ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil' C:/Ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline' C:/Ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line' C:/Ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new' C:/Ruby/lib/ruby/1.8/net/http.rb:1059:in `request' C:/Ruby/lib/ruby/1.8/net/http.rb:957:in `request_get' C:/Ruby/lib/ruby/1.8/net/http.rb:380:in `get_response' C:/Ruby/lib/ruby/1.8/net/http.rb:547:in `start' C:/Ruby/lib/ruby/1.8/net/http.rb:379:in `get_response' C:/Ruby/lib/ruby/1.8/net/http.rb:356:in `get' ./test/test_configurator.rb:83:in `test_base_handler_config' ./test/test_configurator.rb:82:in `test_base_handler_config' --------------- 61 tests, 541 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [C:/Ruby/bin/ruby -Ilib;ext;bin;test "C:/Ru...] (See full trace by running task with --trace) dir : D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work command : ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" executed command : echo D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:/Users/Luis/.cruise/projects/mongrel-trunk-mswin32/build-997/build.log && ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:\Users\Luis\.cruise\projects\mongrel-trunk-mswin32\build-997\build.log 2>&1 exitstatus: 1 STDERR TAIL START STDERR TAIL END PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ['mongrel-development at rubyforge.org', 'rubyinstaller-devel at rubyforge.org'] project.rake_task = 'clobber compile test' project.scheduler.polling_interval = 5.minutes end From builder at mmediasys.com Sun Mar 30 22:51:09 2008 From: builder at mmediasys.com (Integration Builder) Date: Sun, 30 Mar 2008 23:51:09 -0300 Subject: [Mongrel-development] [CruiseControl] mongrel-trunk-mingw32 build 997.1 failed Message-ID: <47f0519d53bd8_de01462a8819a@edicion01.tmail> The build failed. Note: if you set Configuration.dashboard_url in config/site_config.rb, you'd see a link to the build page here. CHANGES ------- Build was manually requested BUILD LOG --------- D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" rake clean (in D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work) [CruiseControl] Invoking Rake task "clobber" Cleaning rake aborted! undefined method `exitstatus' for nil:NilClass D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work/rakefile:127:in `sub_project' (See full trace by running task with --trace) dir : D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work command : ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" executed command : echo D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/build-997.1/build.log && ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:\Users\Luis\.cruise\projects\mongrel-trunk-mingw32\build-997.1\build.log 2>&1 exitstatus: 1 STDERR TAIL START STDERR TAIL END PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ['mongrel-development at rubyforge.org', 'rubyinstaller-devel at rubyforge.org'] project.rake_task = 'clobber compile test' project.scheduler.polling_interval = 5.minutes end From luislavena at gmail.com Sun Mar 30 23:57:06 2008 From: luislavena at gmail.com (Luis Lavena) Date: Mon, 31 Mar 2008 00:57:06 -0300 Subject: [Mongrel-development] Mongrel and Windows: I was so dumb Message-ID: <71166b3b0803302057k7ade0b07r71cf8929c4fe1bcf@mail.gmail.com> Hello guys, I seems that I messed with my environment a bit, and that's why some of the test failed. The truth is that I switched from desktop to notebook a few weeks back, and most of the development was done on desktop until two weeks back. Since my notebook is loaded with NOD32 v3, versus my desktop with version 2.7, it seems they have a "web filter" that was blocking ruby.exe bad HTTP requests. Yeah, SO DUMB! Sorry I made you guys waste time checking for this... It wouldn't happen again :-D Also, I'm working on a series of patches that take care of mingw as platform. I'm just tired of RUBY_PLATFORM regex. Can we add Mongrel.windows? and Mongrel.java? Regards guys. -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Mon Mar 31 00:04:51 2008 From: evan at cloudbur.st (Evan Weaver) Date: Mon, 31 Mar 2008 00:04:51 -0400 Subject: [Mongrel-development] Mongrel and Windows: I was so dumb In-Reply-To: <71166b3b0803302057k7ade0b07r71cf8929c4fe1bcf@mail.gmail.com> References: <71166b3b0803302057k7ade0b07r71cf8929c4fe1bcf@mail.gmail.com> Message-ID: Wow, that is bizarre. The platform checks are fine. Do they belong in Mongrel, or do they belong in the build chain? Evan On Sun, Mar 30, 2008 at 11:57 PM, Luis Lavena wrote: > Hello guys, > > I seems that I messed with my environment a bit, and that's why some > of the test failed. > > The truth is that I switched from desktop to notebook a few weeks > back, and most of the development was done on desktop until two weeks > back. > > Since my notebook is loaded with NOD32 v3, versus my desktop with > version 2.7, it seems they have a "web filter" that was blocking > ruby.exe bad HTTP requests. > > Yeah, SO DUMB! > > Sorry I made you guys waste time checking for this... > > It wouldn't happen again :-D > > Also, I'm working on a series of patches that take care of mingw as > platform. I'm just tired of RUBY_PLATFORM regex. Can we add > Mongrel.windows? and Mongrel.java? > > Regards guys. > > -- > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Mon Mar 31 00:25:34 2008 From: luislavena at gmail.com (Luis Lavena) Date: Mon, 31 Mar 2008 01:25:34 -0300 Subject: [Mongrel-development] Mongrel and Windows: I was so dumb In-Reply-To: References: <71166b3b0803302057k7ade0b07r71cf8929c4fe1bcf@mail.gmail.com> Message-ID: <71166b3b0803302125m1db26236m25ba80c317fb0c3b@mail.gmail.com> On Mon, Mar 31, 2008 at 1:04 AM, Evan Weaver wrote: > Wow, that is bizarre. > > The platform checks are fine. Do they belong in Mongrel, or do they > belong in the build chain? > Specific platform usage inside mongrel: - To writer or not the pid file: http://mongrel.rubyforge.org/browser/trunk/lib/mongrel/configurator.rb#L83 (which is pointless, it should generate the pid file on every platform, even Windows). - Allow or not daemonize: http://mongrel.rubyforge.org/browser/trunk/lib/mongrel/configurator.rb#L189 Which is fair, it should remain there - Setup signals: http://mongrel.rubyforge.org/browser/trunk/lib/mongrel/configurator.rb#L364 Which is also good. Other places: http://mongrel.rubyforge.org/browser/trunk/bin/mongrel_rails#L139 the usage of restart on Windows, seems logical, since there are no signals to handle it. Oh, a good catch: http://mongrel.rubyforge.org/browser/trunk/bin/mongrel_rails#L85 Mongrel should validate pre-existing pids always, not only in daemonize mode. Thoughts? To use or not fastthread and cgi eof fix. http://mongrel.rubyforge.org/browser/trunk/lib/mongrel.rb#L13 Of course, a few more check on the new Logger (buffered logger) and cgi_multipart eof subproject. Fastthread, GemPlugin and even mongrel_service (yeah, I plain suck at planing on the long run). -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From evan at cloudbur.st Mon Mar 31 00:27:25 2008 From: evan at cloudbur.st (Evan Weaver) Date: Mon, 31 Mar 2008 00:27:25 -0400 Subject: [Mongrel-development] Mongrel and Windows: I was so dumb In-Reply-To: <71166b3b0803302125m1db26236m25ba80c317fb0c3b@mail.gmail.com> References: <71166b3b0803302057k7ade0b07r71cf8929c4fe1bcf@mail.gmail.com> <71166b3b0803302125m1db26236m25ba80c317fb0c3b@mail.gmail.com> Message-ID: All sounds good. Fastthread and cgi_multipart are going away so there is no sense worrying about them. In 1.2 they get required if they are installed, but they are not gem dependencies for any platform. Evan On Mon, Mar 31, 2008 at 12:25 AM, Luis Lavena wrote: > On Mon, Mar 31, 2008 at 1:04 AM, Evan Weaver wrote: > > Wow, that is bizarre. > > > > The platform checks are fine. Do they belong in Mongrel, or do they > > belong in the build chain? > > > > Specific platform usage inside mongrel: > > - To writer or not the pid file: > > http://mongrel.rubyforge.org/browser/trunk/lib/mongrel/configurator.rb#L83 > > (which is pointless, it should generate the pid file on every > platform, even Windows). > > - Allow or not daemonize: > > http://mongrel.rubyforge.org/browser/trunk/lib/mongrel/configurator.rb#L189 > > Which is fair, it should remain there > > - Setup signals: > > http://mongrel.rubyforge.org/browser/trunk/lib/mongrel/configurator.rb#L364 > > Which is also good. > > Other places: > > http://mongrel.rubyforge.org/browser/trunk/bin/mongrel_rails#L139 > > the usage of restart on Windows, seems logical, since there are no > signals to handle it. > > Oh, a good catch: > > http://mongrel.rubyforge.org/browser/trunk/bin/mongrel_rails#L85 > > Mongrel should validate pre-existing pids always, not only in > daemonize mode. Thoughts? > > To use or not fastthread and cgi eof fix. > > http://mongrel.rubyforge.org/browser/trunk/lib/mongrel.rb#L13 > > Of course, a few more check on the new Logger (buffered logger) and > cgi_multipart eof subproject. Fastthread, GemPlugin and even > mongrel_service (yeah, I plain suck at planing on the long run). > > -- > > > Luis Lavena > Multimedia systems > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Mongrel-development mailing list > Mongrel-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC From luislavena at gmail.com Mon Mar 31 00:29:07 2008 From: luislavena at gmail.com (Luis Lavena) Date: Mon, 31 Mar 2008 01:29:07 -0300 Subject: [Mongrel-development] Mongrel and Windows: I was so dumb In-Reply-To: References: <71166b3b0803302057k7ade0b07r71cf8929c4fe1bcf@mail.gmail.com> Message-ID: <71166b3b0803302129r2afc0a4ctadd9359bade2bdad@mail.gmail.com> On Mon, Mar 31, 2008 at 1:04 AM, Evan Weaver wrote: > Wow, that is bizarre. > yeah, also if two builders run at the same time, they have a port collition. I'm adding process_based_port to testhelp.rb to provide a port, based on 5000 and the process number: irb(main):001:0> 5000 + $$ % 1000 => 5656 That will make my CI happy :-) (I'm doing the changes right now for rubygems too, found a clash due that during setup). Oh, and forgot to make it generate the artifacts, so we can grab the pre-compiled gem from there ;-) Regards, -- Luis Lavena Multimedia systems - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From builder at mmediasys.com Mon Mar 31 01:30:22 2008 From: builder at mmediasys.com (Integration Builder) Date: Mon, 31 Mar 2008 02:30:22 -0300 Subject: [Mongrel-development] [CruiseControl] mongrel-trunk-mingw32 build 998 failed Message-ID: <47f076ee66c88_de01462a88286@edicion01.tmail> The build failed. Note: if you set Configuration.dashboard_url in config/site_config.rb, you'd see a link to the build page here. CHANGES ------- New revision 998 detected Revision 998 committed by luislavena on 2008-03-31 05:25:39 Remove fixed port numbers used in tests, make tests more friendly to CI tools. Use of #process_based_port as port number. M /trunk/test/test_redirect_handler.rb M /trunk/test/test_handlers.rb M /trunk M /trunk/test/test_configurator.rb M /trunk/test/test_conditional.rb M /trunk/test/test_ws.rb M /trunk/test/testhelp.rb M /trunk/test/test_request_progress.rb BUILD LOG --------- D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" rake clean (in D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work) [CruiseControl] Invoking Rake task "clobber" Cleaning rake aborted! undefined method `exitstatus' for nil:NilClass D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work/rakefile:127:in `sub_project' (See full trace by running task with --trace) dir : D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work command : ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" executed command : echo D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:/Users/Luis/.cruise/projects/mongrel-trunk-mingw32/build-998/build.log && ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:\Users\Luis\.cruise\projects\mongrel-trunk-mingw32\build-998\build.log 2>&1 exitstatus: 1 STDERR TAIL START STDERR TAIL END PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ['mongrel-development at rubyforge.org', 'rubyinstaller-devel at rubyforge.org'] project.rake_task = 'clobber compile test' project.scheduler.polling_interval = 5.minutes end From builder at mmediasys.com Mon Mar 31 04:30:03 2008 From: builder at mmediasys.com (Integration Builder) Date: Mon, 31 Mar 2008 05:30:03 -0300 Subject: [Mongrel-development] [CruiseControl] mongrel-stable_1-2-mswin32 build 1001 failed Message-ID: <47f0a10bbeac8_ee013de3a612@edicion01.tmail> The build failed. Note: if you set Configuration.dashboard_url in config/site_config.rb, you'd see a link to the build page here. CHANGES ------- This is the first build BUILD LOG --------- D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mswin32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" D:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/bin/ruby extconf.rb (in D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mswin32/work) [CruiseControl] Invoking Rake task "clobber" Cleaning [CruiseControl] Invoking Rake task "compile" checking for main() in c.lib... no creating Makefile Microsoft (R) Program Maintenance Utility Version 6.00.9782.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. D:\Users\Luis\ruby\ruby-186-p114-VC6-rubygems-110\bin\ruby -e "puts 'EXPORTS', 'Init_http11'" > http11-i386-mswin32.def cl -nologo -I. -I. -ID:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tchttp11.c http11.c cl -nologo -I. -I. -ID:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tchttp11_parser.c http11_parser.c cl -nologo -LD -Fehttp11.so http11.obj http11_parser.obj msvcrt-ruby18.lib oldnames.lib user32.lib advapi32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -dll -libpath:"." -libpath:"D:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/lib" -def:http11-i386-mswin32.def -implib:http11-i386-mswin32.lib -pdb:http11-i386-mswin32.pdb Creating library http11-i386-mswin32.lib and object http11-i386-mswin32.exp D:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/bin/ruby -Ilib;ext;bin;test "D:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/test_helper.rb" "test/unit/test_cgi_wrapper.rb" "test/unit/test_command.rb" "test/unit/test_conditional.rb" "test/unit/test_configurator.rb" "test/unit/test_debug.rb" "test/unit/test_handlers.rb" "test/unit/test_http_parser.rb" "test/unit/test_redirect_handler.rb" "test/unit/test_request_progress.rb" "test/unit/test_response.rb" "test/unit/test_stats.rb" "test/unit/test_uriclassifier.rb" "test/unit/test_ws.rb" [CruiseControl] Invoking Rake task "test" ./test/test_helper.rb:8: warning: already initialized constant HERE Loaded suite D:/Users/Luis/ruby/ruby-186-p114-VC6-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader Started .......................F..E................................ Finished in 32.297 seconds. 1) Failure: test_horrible_queries(HttpParserTest) [./test/unit/test_http_parser.rb:105:in `test_horrible_queries' ./test/unit/test_http_parser.rb:103:in `times' ./test/unit/test_http_parser.rb:103:in `test_horrible_queries']: exception expected but none was thrown. 2) Error: test_parse_strange_headers(HttpParserTest): Mongrel::HttpParserError: Invalid HTTP format, parsing fails. ./test/unit/test_http_parser.rb:49:in `execute' ./test/unit/test_http_parser.rb:49:in `test_parse_strange_headers' 59 tests, 458 assertions, 1 failures, 1 errors rake aborted! Command failed with status (1): [D:/Users/Luis/ruby/ruby-186-p114-VC6-rubyg...] (See full trace by running task with --trace) dir : D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mswin32/work command : ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" executed command : echo D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mswin32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mswin32/build-1001/build.log && ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:\Users\Luis\.cruise\projects\mongrel-stable_1-2-mswin32\build-1001\build.log 2>&1 exitstatus: 1 STDERR TAIL START STDERR TAIL END PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ['mongrel-development at rubyforge.org', 'rubyinstaller-devel at rubyforge.org'] project.rake_task = 'clobber compile test package' project.scheduler.polling_interval = 5.minutes end From builder at mmediasys.com Mon Mar 31 04:30:26 2008 From: builder at mmediasys.com (Integration Builder) Date: Mon, 31 Mar 2008 05:30:26 -0300 Subject: [Mongrel-development] [CruiseControl] mongrel-stable_1-2-mingw32 build 1001 failed Message-ID: <47f0a122222e0_bd41462a8815d@edicion01.tmail> The build failed. Note: if you set Configuration.dashboard_url in config/site_config.rb, you'd see a link to the build page here. CHANGES ------- This is the first build BUILD LOG --------- D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mingw32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/bin/ruby extconf.rb (in D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mingw32/work) [CruiseControl] Invoking Rake task "clobber" Cleaning [CruiseControl] Invoking Rake task "compile" checking for main() in -lc... no creating Makefile gcc -I. -I. -ID:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -c http11.c gcc -I. -I. -ID:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -c http11_parser.c gcc -shared -s -o http11.so http11.o http11_parser.o -L. -LD:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib -L. -Wl,--enable-auto-image-base,--enable-auto-import,--export-all -lmsvcrt-ruby18 -lshell32 -lws2_32 D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/bin/ruby -Ilib;ext;bin;test "D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb" "test/test_helper.rb" "test/unit/test_cgi_wrapper.rb" "test/unit/test_command.rb" "test/unit/test_conditional.rb" "test/unit/test_configurator.rb" "test/unit/test_debug.rb" "test/unit/test_handlers.rb" "test/unit/test_http_parser.rb" "test/unit/test_redirect_handler.rb" "test/unit/test_request_progress.rb" "test/unit/test_response.rb" "test/unit/test_stats.rb" "test/unit/test_uriclassifier.rb" "test/unit/test_ws.rb" [CruiseControl] Invoking Rake task "test" ./test/test_helper.rb:8: warning: already initialized constant HERE ./test/unit/test_command.rb:9: uninitialized constant GemPlugin (NameError) from D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5:in `load' from D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5 from D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5:in `each' from D:/Users/Luis/ruby/ruby-186-svn-MINGW-rubygems-110/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5 rake aborted! Command failed with status (1): [D:/Users/Luis/ruby/ruby-186-svn-MINGW-ruby...] (See full trace by running task with --trace) dir : D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mingw32/work command : ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" executed command : echo D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mingw32/work Luis$ ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:/Users/Luis/.cruise/projects/mongrel-stable_1-2-mingw32/build-1001/build.log && ruby -e "require 'rubygems' rescue nil; require 'rake'; load 'D:/Users/Luis/tools/ccrb/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" >> D:\Users\Luis\.cruise\projects\mongrel-stable_1-2-mingw32\build-1001\build.log 2>&1 exitstatus: 1 STDERR TAIL START STDERR TAIL END PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ['mongrel-development at rubyforge.org', 'rubyinstaller-devel at rubyforge.org'] project.rake_task = 'clobber compile test package' project.scheduler.polling_interval = 5.minutes end