Subject: Re: [xmpp] #3: whitespace pings are in fact keepalives

From: Jiří Zárevúcky <[email-masked]>
Date: Sat, 01 Aug 2009 16:09:50 +0200

On 07/31/2009 05:18 PM, Peter Saint-Andre wrote:
> On 7/7/09 12:52 AM, xmpp issue tracker wrote:
>    
>> #3: whitespace pings are in fact keepalives
>> ...
>>      
> I have fixed this in my working copy. The paragraph in which the
> relevant text is found now reads as follows:
>
>     An XML stream can appear idle at the XMPP level because the
>     underlying TCP connection has become idle (e.g., a client's network
>     connection has been lost).  The typical method for detecting an idle
>     TCP connection is to send a space character (U+0020) over the TCP
>     connection between XML stanzas, which is allowed for XML streams as
>     described under Section 12.7.  The sending of such a space character
>     is properly called a WHITESPACE KEEPALIVE (although the term
>     "whitespace ping" is in common use, in fact it is not a ping since no
>     "pong" is possible).  The time between such whitespace keepalives (or
>     other connection-testing methods) is a matter of implementation and
>     local service policy; however, it is RECOMMENDED that any such test
>     be performed not more than once every 60 seconds.
>
> Peter
>    

That's still not good. You can't use whitespace to detect idle 
connection, because there is no response from the server and TCP timeout 
is usually veeery long. The only use I can see would be preventing 
connection timeout. That being said, it's not a "test" and the paragraph 
in this form is strongly misleading.

---

From: Justin Karneges <[email-masked]>
Date: Sat, 1 Aug 2009 09:09:32 -0700

> in this form is strongly misleading.

Even though the TCP timeout is very long, it's still better than no timeout at 
all.  Servers send whitespace keepalives to clients, to bust connections that 
might be broken.  This will ensure dead clients get sweeped away in about 20 
minutes, rather than potentially never.

-Justin

---

From: Jiří Zárevúcky <[email-masked]>
Date: Sat, 01 Aug 2009 20:46:01 +0200

> minutes, rather than potentially never.

Yes, but 20 minutes still doesn't equal either "test" or "idle 
detection". That's why I'm saying the paragraph is misleading. Nobody 
who wants to sweep dead clients will likely rely on mechanism that takes 
20 minutes to manifest itself. It's more likely server will cut the 
client sooner, for inactivity.

---

From: Peter Saint-Andre <[email-masked]>
Date: Mon, 03 Aug 2009 13:44:36 -0600

> client sooner, for inactivity.

The core XMPP specification will never solve this problem. However, it
might be helpful to provide more detailed guidance to XMPP implementers
on this topic, and to mention other connection-testing methods. Thus I
have modified the text as follows.

   An XML stream can appear idle at the XMPP level because the
   underlying TCP connection has become idle (e.g., a client's network
   connection has been lost).  One common method for detecting an idle
   TCP connection is to send a space character (U+0020) over the TCP
   connection between XML stanzas, which is allowed for XML streams as
   described under Section 12.7; the sending of such a space character
   is properly called a WHITESPACE KEEPALIVE (although the term
   "whitespace ping" is often used, in fact it is not a ping since no
   "pong" is possible).  Other connection-testing methods include the
   application-level pings described in [XEP-0199] and the more
   comprehensive stream management protocol described in [XEP-0198].
   Implementers are advised to support whichever connection-testing
   methods they deem appropriate, but to carefully weigh the network
   impact of such methods against the benefits of discovering idle
   streams in a timely manner.  The length of time between the use of
   any particular connection test is a matter of implementation and
   local service policy; however, it is RECOMMENDED that any such test
   be performed not more than once every 60 seconds.

Peter

- --
Peter Saint-Andre
https://stpeter.im/

---

From: Joe Hildebrand <[email-masked]>
Date: Tue, 04 Aug 2009 10:48:55 -0600

Re: whitespace.  Keep in mind that if one side of the connection uses this
information to detect that the connection has gone bad in some way, that's
great, but one of the main reasons we do the keepalives is to ensure that
firewalls and NATs don't close the connection for inactivity.  Typically,
the traditional TCP keepalive does not occur often enough to meet these
needs, so we simulate them in the application layer.

-- 
Joe Hildebrand