Re: policy server causing CLOSE_WAIT On Mon, 18 Feb 2008 17:28:53 -0600
"Dan Lists"  wrote:

> On Feb 18, 2008 5:12 PM, Victor Duchovni
>  wrote:
> 
> > On Mon, Feb 18, 2008 at 05:02:50PM -0600, Dan Lists wrote:
> >
> > > I wrote a very simple policy server using Net::Server.  It works
> > correctly,
> > > except that there are always CLOSE_WAITs sticking around.  I did a
> > tcpdump
> > > of the loopback device, and the policy daemon is closing its side
> > > of the connection, but postfix is taking 2 seconds (or more) to
> > > close its end. Perhaps not coincidentally, 2 seconds (or more) is
> > > how long it takes
> > postfix
> > > to hand the message off to the content filter (amavis).
> > >
> > > From my main.cf:
> > >
> > > content_filter=smtp-amavis:[127.0.0.1]:10024
> > >
> > > smtpd_end_of_data_restrictions =
> > >    check_policy_service inet:127.0.0.1:9999
> > >
> > > So, is postfix leaving the connection to the policy daemon open
> > > until it
> > can
> > > hand the message off to amavis, or is something else happening?
> > >
> > > If so, can I change that behavior?
> > >
> > > Any other thoughts as to why I have CLOSE_WAITS sitting around
> > > for many seconds?
> >
> > The policy service is not expected to disconnect unilaterally.
> > Rather it should process multiple requests from the same smtpd
> > process until the SMTP server disconnects.
> >
> >
> So I should set  smtpd_policy_service_max_idle to be less than my
> policy server's timeout,
> and have my policy server answer multiple requests?
> 
> That wasn't obvious to me from reading SMTPD_POLICY_README.

This is toward the top of that readme:

  Policy delegation is now the preferred method for adding policies to
  Postfix. It's much easier to develop a new feature in few lines of
  Perl, Python, Ruby, or TCL, than trying to do the same in C code. The
  difference in performance will be unnoticeable except in the most
  demanding environments. On active systems a policy daemon process is
  used multiple times, for up to $max_use incoming SMTP connections.

max_use (default: 100)

  The maximal number of incoming connections that a Postfix daemon
  process will service before terminating voluntarily. This parameter is
  ignored by the Postfix queue manager and by other long-lived Postfix
  daemon processes.

-------
  _|_
 (_| |


