jsonrpc-server: Disconnect connections that queue too much data.
authorBen Pfaff <blp@nicira.com>
Wed, 27 Mar 2013 21:38:11 +0000 (14:38 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 3 Apr 2013 02:21:27 +0000 (19:21 -0700)
commitbedbab1a0f2a3cef6c89a3889d424ed6f09309d3
treea6402a5f5d6b712648eaa76fab19a02188e9432e
parent4a95e9bf2a4fc1d2b261a4cc2071e190e3a15ddc
jsonrpc-server: Disconnect connections that queue too much data.

Consider this situation:

    * OVSDB client A executes transactions very quickly for a long time.

    * OVSDB client B monitors the tables that A modifies, but (either
      because B is connected over a slow network, or because B is slow to
      process updates) cannot keep up.

In this situation, the data that ovsdb-server has queued to send B grows
without bound and eventually ovsdb-server runs out of memory.  This commit
avoids the problem by noticing that more data is queued to B than necessary
to express the whole contents of the database and dropping the connection
to B.  When B reconnects later, it can then fetch the contents of the
database using less data than was previously queued to it.

(This is not entirely hypothetical.  We have seen this behavior in
intentional stress tests.)

Bug #15637.
Reported-by: Jeff Merrick <jmerrick@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovsdb/jsonrpc-server.c