diff options
author | andy zhou <azhou@ovn.org> | 2016-03-07 15:44:34 -0800 |
---|---|---|
committer | Andy Zhou <azhou@ovn.org> | 2016-03-08 11:20:19 -0800 |
commit | f76def2592cc5cb449a3360430ee9cc0f208765d (patch) | |
tree | d396edb208291957de84c40774f63a01456690aa /ovsdb/jsonrpc-server.c | |
parent | 1b4993133f281a9b181aedc9f56930ab4b4de65a (diff) | |
download | openvswitch-f76def2592cc5cb449a3360430ee9cc0f208765d.tar.gz |
ovsdb-server: Fix a reference count leak bug
When destroying an ovsdb_jsonrpc_monitor, the jsonrpc monitor still
holds a reference count to the monitors 'changes' indexed with
'unflushed' transaction id. The bug is that the reference count was
not decremented as it should in the code path.
The bug caused 'changes' that have been flushed to all jsonrpc
clients to linger around unnecessarily, occupying increasingly
large amount of memory. See "Reported-at" URL for more details.
This bug is tricky to find since the memory is not leaked; they will
eventually be freed when monitors are destroyed.
Reported-by: Lei Huang <huang.f.lei@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-March/067274.html
Signed-off-by: Andy Zhou <azhou@ovn.org>
Tested-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Liran Schour <lirans@il.ibm.com>
Diffstat (limited to 'ovsdb/jsonrpc-server.c')
-rw-r--r-- | ovsdb/jsonrpc-server.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c index 15dbc4e74..caaf2bf49 100644 --- a/ovsdb/jsonrpc-server.c +++ b/ovsdb/jsonrpc-server.c @@ -1265,7 +1265,7 @@ ovsdb_jsonrpc_monitor_create(struct ovsdb_jsonrpc_session *s, struct ovsdb *db, dbmon = ovsdb_monitor_add(m->dbmon); if (dbmon != m->dbmon) { /* Found an exisiting dbmon, reuse the current one. */ - ovsdb_monitor_remove_jsonrpc_monitor(m->dbmon, m); + ovsdb_monitor_remove_jsonrpc_monitor(m->dbmon, m, m->unflushed); ovsdb_monitor_add_jsonrpc_monitor(dbmon, m); m->dbmon = dbmon; } @@ -1348,7 +1348,7 @@ ovsdb_jsonrpc_monitor_destroy(struct ovsdb_jsonrpc_monitor *m) { json_destroy(m->monitor_id); hmap_remove(&m->session->monitors, &m->node); - ovsdb_monitor_remove_jsonrpc_monitor(m->dbmon, m); + ovsdb_monitor_remove_jsonrpc_monitor(m->dbmon, m, m->unflushed); free(m); } |