Re: stale connections, keepalive?

2016-08-28 Thread Christof Meerwald
On Sun, Aug 28, 2016 at 02:13:34PM +0200, Tomasz Sterna wrote:
> W dniu 27.08.2016, sob o godzinie 14∶55 -0400, użytkownik Greg Troxel
> napisał:
> >   should jabberd2 force TCP keepalive on?
> I'm not sure whether it is possible.
> At least on Linux it is a system-wide setting and requires root to
> change.

Are you sure? There appear to be some socket options that can be set
for each socket:

http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/#setsockopt


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org




Re: stale connections, keepalive?

2016-08-28 Thread Tomasz Sterna
W dniu 27.08.2016, sob o godzinie 14∶55 -0400, użytkownik Greg Troxel
napisał:
>   should jabberd2 force TCP keepalive on?

I'm not sure whether it is possible.
At least on Linux it is a system-wide setting and requires root to
change.


>   should c2s (and s2s probably, but less likely to be an issue) close
>   client connections if it has not seen anything from the client in
> some time period, like 8h?
>   is there any expectation in the protocol that clients should be
> doing any application-level keep-alive?

jabberd2 has support for application layer keepalives.

See io.keepalive [1][2] options.
Setting this up will flush single whitespace character over the wire
when the connection dangs idle. This triggers the TCP layer connection
validation.


Having said that, I am running my server without both application layer
and TCP keepalives turned on and see no issues with dangling
connections.

But.. I had them a lot, when my server was behind a buggy Cisco router
doing NAT. It was dropping idle connections from its NAT table without
telling anyone, so later when mobile network closed a connection it
silently dropped RST packets not knowing who to NAT them to. This was
causing a lot of dangling connections on my server.

Maybe you should investigate your network before turning on keepalives
as they cause unnecessary data transfer and battery usage on the mobile
devices.


[1] https://github.com/jabberd2/jabberd2/blob/master/etc/c2s.xml.dist.in#L335
[2] https://github.com/jabberd2/jabberd2/blob/master/etc/s2s.xml.dist.in#L228

-- 
 /o__ Q: How many Zen masters does it take to screw in a light bulb?
(_<^' A: None. The Universe spins the bulb, and the Zen master stays out

signature.asc
Description: This is a digitally signed message part