On 30/08/09 21:58, Robin Bowes wrote:

> I put a warning in Qpsmtpd::Apache::start_connection (in file
> Apache/Qpsmtpd.pm) .. and noticed that it was being triggered multiple
> times on just one connection at approximately 5 minute intervals:

OK, I think there are two issues here:

1. It seems that setting the timeout on the apache connection socket
doesn't have any effect, ie. the socket does not timeout.

The qpsmtpd-specified timeout does *not* come into play until qpsmtpd
starts reading data in Qpsmtpd::SMTPD::getline (which is called from
Qpsmtpd::SMTPD::data_respond). Until data starts, the code sits waiting
in Qpsmtpd::Apache::getline at:

my $rc = $c->input_filters->get_brigade($bb, Apache2::Const::MODE_GETLINE);

Wrapping the get_brigade call with similar alarm calls to those in
Qpsmtpd::SMTPD::getline seems to fix the issue:

    my $timeout = $self->config('timeout');
    while (1) {
        alarm($timeout);
        my $rc = $c->input_filters->get_brigade($bb,
Apache2::Const::MODE_GETLINE);
        alarm(0);

2. Before get_brigade returns, something else seems to call into
Apache::Qpsmtpd::handler, and a new connection is started. This can be
seen by adding instrumentation to Apache::Qpsmtpd::handler, starting a
connection (telnet localhost 25) and waiting:

New connection started at Sun Aug 30 22:31:32 2009 at
/usr/lib/perl5/site_perl/Apache/Qpsmtpd.pm line 29.
New connection started at Sun Aug 30 22:35:00 2009 at
/usr/lib/perl5/site_perl/Apache/Qpsmtpd.pm line 29.
New connection started at Sun Aug 30 22:40:01 2009 at
/usr/lib/perl5/site_perl/Apache/Qpsmtpd.pm line 29.

I'm not sure what causes this.

R.

Reply via email to