From: Alex Wang Date: Thu, 18 Sep 2014 17:49:47 +0000 (-0700) Subject: jsonrpc: Notify excessive sending backlog. X-Git-Tag: v2.4.0~1357 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=65b81af3b4e16fda76e865451ee259fac1948721;p=cascardo%2Fovs.git jsonrpc: Notify excessive sending backlog. This commit adds a log message to notify the excessive backlog for jsonrpc. Expectedly, this message should never be printed. Signed-off-by: Alex Wang Acked-by: Ben Pfaff --- diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 0841ad81d..a9f6a2a55 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -47,6 +47,7 @@ struct jsonrpc { /* Output. */ struct list output; /* Contains "struct ofpbuf"s. */ + size_t output_count; /* Number of elements in "output". */ size_t backlog; }; @@ -124,6 +125,7 @@ jsonrpc_run(struct jsonrpc *rpc) ofpbuf_pull(buf, retval); if (!ofpbuf_size(buf)) { list_remove(&buf->list_node); + rpc->output_count--; ofpbuf_delete(buf); } } else { @@ -257,8 +259,15 @@ jsonrpc_send(struct jsonrpc *rpc, struct jsonrpc_msg *msg) ofpbuf_use(buf, s, length); ofpbuf_set_size(buf, length); list_push_back(&rpc->output, &buf->list_node); + rpc->output_count++; rpc->backlog += length; + if (rpc->output_count >= 50) { + VLOG_INFO_RL(&rl, "excessive sending backlog, jsonrpc: %s, num of" + " msgs: %"PRIuSIZE", backlog: %"PRIuSIZE".", rpc->name, + rpc->output_count, rpc->backlog); + } + if (rpc->backlog == length) { jsonrpc_run(rpc); } @@ -496,6 +505,7 @@ jsonrpc_cleanup(struct jsonrpc *rpc) ofpbuf_list_delete(&rpc->output); rpc->backlog = 0; + rpc->output_count = 0; } static struct jsonrpc_msg *