From: Egoitz Aurrekoetxea Aurre on
Hi,

I'm pretty sure about this but... I prefer asking for being totally
sure. Hey mates imagine a policy daemon has a (server time limit) time
limit of 3600 seconds... like hasn't arrived the max_idle time...
spawn doesn't close it.... and now it's near to it's time_limit....
imagine that in 120 seconds arrives the configured time_limit for the
policy (the 3600 seconds)... Now and smtpd proccess connects to it and
it's going to accept a big mail over a slow inet connection... so it's
going to take perhaps 600 seconds to receive the mail.... is the
policy daemon closed by spawn when that 120 seconds arrive and then
smtpd proccess will retry to connect again to a new available (not
linked by any smtpd proccess) or just new spawed policy daemon or does
spawn wait till smtpd proccess ends with policy daemon althouhg the
120 seconds have passed? or if the policy daemon doesn't never exit
because enters in a loop (a good loop I mean accept parameters decide,
accept parameter decide and so) it's still alive (doesn't die in those
120 seconds) till smtpd proccess dies for some reason (max_use or
max_idle)?.

Thanks a lot mates.

Bye!!
From: Wietse Venema on
Egoitz Aurrekoetxea Aurre:
> Hi,
>
> I'm pretty sure about this but... I prefer asking for being totally
> sure. Hey mates imagine a policy daemon has a (server time limit) time
> limit of 3600 seconds... like hasn't arrived the max_idle time...
> spawn doesn't close it.... and now it's near to it's time_limit....
> imagine that in 120 seconds arrives the configured time_limit for the
> policy (the 3600 seconds)... Now and smtpd proccess connects to it and
> it's going to accept a big mail over a slow inet connection... so it's

When you are running the policy service under the spawn daemon:

1) The time limit BEGINS after an SMTP server connects to the
policy server port, when a new policy daemon process is created.
Thus, an SMTP server always "mates" with a policy server that
has the full time limit left.

2) The time limit ENDS after an SMTP server process disconnects,
because the policy daemon terminates immediately.

If you still think the time limit is too short, make it longer.

Wietse

> going to take perhaps 600 seconds to receive the mail.... is the
> policy daemon closed by spawn when that 120 seconds arrive and then
> smtpd proccess will retry to connect again to a new available (not
> linked by any smtpd proccess) or just new spawed policy daemon or does
> spawn wait till smtpd proccess ends with policy daemon althouhg the
> 120 seconds have passed? or if the policy daemon doesn't never exit
> because enters in a loop (a good loop I mean accept parameters decide,
> accept parameter decide and so) it's still alive (doesn't die in those
> 120 seconds) till smtpd proccess dies for some reason (max_use or
> max_idle)?.
>
> Thanks a lot mates.
>
> Bye!!
>
>

From: Egoitz Aurrekoetxea Aurre on

El 12/09/2009, a las 15:38, Wietse Venema escribi=F3:

> Egoitz Aurrekoetxea Aurre:
>>>> When you are running the policy service under the spawn daemon:
>>>>
>>>> 1) The time limit BEGINS after an SMTP server connects to the
>>>> policy server port, when a new policy daemon process is created.
>>>> Thus, an SMTP server always "mates" with a policy server that
>>>> has the full time limit left.
>
> After the SMTP server has "mated" with a new policy daemon process,
> the SMTP server keeps the connection open until it terminates.
> During this time, the SMTP server will handle one or more SMTP
> client requests, such as multiple requests in one SMTP session or
> requests from different SMTP client (one SMTP client connects,
> disconnects, another SMTP client connects, etc.)
>
> When the SMTP server disconnects from the policy daemon, the
> policy daemon must terminate.

and how could I know that the smtp server has disconnected from the =20
policy server? what does postfix send for knowing it? I mean like it's =20=

tcpwrapped by spawn I don't know either some is connected or not.... =20
it's just running waiting for attributes... For example, after I send =20=

an email (so after connecting to an smtpd proccess and after sending =20
the mail and the quit command to postfix smtpd) if I do the following =20=

ps I see :

$ ps aux | grep pl && ps aux | grep smtp
cyrus 68585 0.2 0.4 23784 7852 ?? Ss 4:20PM 0:00.08 /usr/=20=

bin/perl /usr/local/etc/postfix/postfix-qreject-frontales.pl (perl5.8.8)
postfix 68584 0.0 0.1 13704 2232 ?? S 4:20PM 0:00.00 =20
spawn -z -n 127.0.0.1:2222 -t inet user=3Dcyrus argv=3D/usr/local/etc/=20=

postfix/postfix-qreject-frontales.pl
postfix 68581 0.0 0.2 29456 4236 ?? S 4:20PM 0:00.01 =20
smtpd -n smtp -t inet -u
postfix 68589 0.0 0.1 13828 2428 ?? S 4:20PM 0:00.01 smtp =20=

-n smtp-amavis -t unix -u -o smtp_data_done_timeout=3D1200 -o =20
disable_dns_lookups=3Dyes
postfix 68591 0.0 0.2 28432 3692 ?? S 4:20PM 0:00.01 =20
[smtpd]


so I have a spawn proccess for each the policy daemon (frontales.pl) =20=

and the own policy daemon running in this example with the user cyrus...


> It is an error to terminate before
> the SMTP server disconnects.

That's why policy daemon closes all mysql connections, all file =20
descriptors and all before printing action to STDOUT later clears =20
hash table of attributes and starts a new cycle
>
>
> In particular, the policy daemon should not terminate after each
> request. This would waste a lot of system resources.

That's why I do it this way, so it's done well then.
>
>
> If you believe that your SMTP server processes will be running fore
> more than 3600s (for example, when receiving large messages over
> a dialup connection) then increase the limit.
>
> Wietse

Thanks a lot really Wietse.=
From: Wietse Venema on
Egoitz Aurrekoetxea Aurre:
> > Egoitz Aurrekoetxea Aurre:
> >>>> When you are running the policy service under the spawn daemon:
> >>>>
> >>>> 1) The time limit BEGINS after an SMTP server connects to the
> >>>> policy server port, when a new policy daemon process is created.
> >>>> Thus, an SMTP server always "mates" with a policy server that
> >>>> has the full time limit left.
> >
> > After the SMTP server has "mated" with a new policy daemon process,
> > the SMTP server keeps the connection open until it terminates.
> > During this time, the SMTP server will handle one or more SMTP
> > client requests, such as multiple requests in one SMTP session or
> > requests from different SMTP client (one SMTP client connects,
> > disconnects, another SMTP client connects, etc.)
> >
> > When the SMTP server disconnects from the policy daemon, the
> > policy daemon must terminate.
>
> and how could I know that the smtp server has disconnected from the
> policy server? what does postfix send for knowing it?

When you run the policy service under the Postfix spawn daemon,
terminate when a read operation returns an end-of-file indication.

Wietse
From: Egoitz Aurrekoetxea Aurre on
>>>
>>
>> and how could I know that the smtp server has disconnected from the
>> policy server? what does postfix send for knowing it?
>
> When you run the policy service under the Postfix spawn daemon,
> terminate when a read operation returns an end-of-file indication.
>
> Wietse

Hi Wietse,

Have just read this... yep this is just what I do, I read from input
fd with <> wich in perl does the trick. I didn't remember I exited
from reading loops with this, because I ended writting this code
perhaps one year ago... and from there has been in testing proccess
although I haven't looked almost at the code because no errors have
appeared. So... it's done then, all perfect :).


Bye thanks!!!