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>
Mon, 1 Apr 2013 20:20:04 +0000 (13:20 -0700)
commit60533a405b2eb77214b767767fe143c8645f82d5
tree794e0750d469e8458860b0885aecf99a0f68a23e
parent0ea7bec76d804a2c4efccd3dbdaa3e30cf536a5c
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