[EXIM] Hanging incoming connections - suggested fix

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Nigel Metheringham
Dátum:  
Címzett: Philip Hazel
CC: Exim Users List
Tárgy: [EXIM] Hanging incoming connections - suggested fix
We have seen incoming SMTP connections hanging - for days if they are left
- when the originating system goes away. This is normally seen on dial-up
IPs. Of course its very hard to reproduce when you need to, but it has
been causing us problems with lots of incoming slots being taken up.

To fix this we have made a small modification to exim which adds keepalive
to the incoming SMTP socket connections. For symmetry we also do this on
outgoing SMTP. This means that if there is no traffic on the socket, the
kernel should periodically send some OOB data - a keepalive - across the
connection. If this fails the read is terminated (there may be a set of
TCP timeouts involved as well). In general the cost of doing this is zero
- it only ever happens on idle connections which should have been killed.

I believe that the setsockopt with keepalive should be pretty portable.

I am not sure that the enclosed patch is the best way of applying the
keepalive - there may be a better location for it in the source. The
keepalive is a socket level option so should just work for IPv6 (Decnet or
whatever) transports as well.

The patch is wrapped in a set of {} to allow me to declare an additional
local variable needed for the setsockopt(). I guess this could upset some
compilers, but for the testing I did not want to add a spare variable up
the top of the function a long way away from the code....

Patch is relative to 2.05. There are no extra options - this doesn't need
to be a selectable option.

    Nigel.


[ Nigel.Metheringham@??? - Systems Software Engineer ]
[ Tel : +44 113 207 6112                   Fax : +44 113 234 6065 ]
[      Real life is but a pale imitation of a Dilbert strip       ]