[EMAIL PROTECTED] (Justin Erenkrantz) writes:

> On Thu, Jun 16, 2005 at 11:28:43AM -0400, Matt Sergeant wrote:
>> On 15 Jun 2005, at 14:47, Justin Erenkrantz wrote:
>> 
>> >As I've mentioned before, we (apache.org) are seeing our qpsmtpd 
>> >processes stuck in an infinite loop.  We're using qpsmtpd-forkserver.
>> 
>> Do you have apache-2/mod_perl 2.x on that box? Sounds like you're 
>> having problems with the server handling code and this would be a good 
>> opportunity to use Apache::Qpsmtpd - let it do all the connection 
>> handling.
>
> I was talking to Joe Schaefer and he said that the Apache::Qpsmtpd
> code still had a bunch of bucket leaks and that we shouldn't use it.
> I have no desire for us to be a guinea pig for untested code.  -- justin


Me neither.  Here's a patch that plugs the bucket leak and upgrades
Apache::Qpsmtpd to the mp2.0 API.  I don't know what this module will
do under load, but it might be worth a shot if qpsmtpd-forkserver is
still segfaulting.

Index: lib/Apache/Qpsmtpd.pm
===================================================================
--- lib/Apache/Qpsmtpd.pm       (revision 191034)
+++ lib/Apache/Qpsmtpd.pm       (working copy)
@@ -6,23 +6,23 @@
 use strict;
 use warnings FATAL => 'all';
 
-use Apache::ServerUtil ();
-use Apache::Connection ();
-use Apache::Const -compile => qw(OK MODE_GETLINE);
+use Apache2::ServerUtil ();
+use Apache2::Connection ();
+use Apache2::Const -compile => qw(OK MODE_GETLINE);
 use APR::Const -compile => qw(SO_NONBLOCK EOF SUCCESS);
 use APR::Error ();
 use APR::Brigade ();
 use APR::Bucket ();
 use APR::Socket ();
-use Apache::Filter ();
+use Apache2::Filter ();
 use ModPerl::Util ();
 # use Apache::TieBucketBrigade;
 
 our $VERSION = '0.02';
 
 sub handler {
-    my Apache::Connection $c = shift;
-    $c->client_socket->opt_set(APR::SO_NONBLOCK => 0);
+    my Apache2::Connection $c = shift;
+    $c->client_socket->opt_set(APR::Const::SO_NONBLOCK => 0);
 
     my $qpsmtpd = Qpsmtpd::Apache->new();
     $qpsmtpd->start_connection(
@@ -35,7 +35,7 @@
     
     $qpsmtpd->run($c);
 
-    return Apache::OK;
+    return Apache2::Const::OK;
 }
 
 package Qpsmtpd::Apache;
@@ -109,14 +109,14 @@
     my $bb = $self->{bb_in};
     
     while (1) {
-        my $rc = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE);
-        return if $rc == APR::EOF;
-        die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
+        my $rc = $c->input_filters->get_brigade($bb, 
Apache2::Const::MODE_GETLINE);
+        return if $rc == APR::Const::EOF;
+        die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS;
         
         while (!$bb->is_empty) {
             my $b = $bb->first;
-            $b->remove;
             $b->read(my $data);
+            $b->delete;
             return $data if index($data, "\n") >= 0;
         }
     }



-- 
Joe Schaefer

Reply via email to