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 <al...@nicira.com> --- PATCH -> V2: - change the log level to INFO and use rate-limiter. - avoid calling list_size(). --- lib/jsonrpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 0841ad8..a9f6a2a 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 * -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev