When rpc sends message failed with return EAGIN, it will try to send again unlimitly. Finally, the memory of ovsdb-server will grow infinitly.
Signed-off-by: ZengGanghui <[email protected]> --- lib/jsonrpc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 2fae057..6506dc2 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -49,6 +49,9 @@ struct jsonrpc { struct ovs_list output; /* Contains "struct ofpbuf"s. */ size_t output_count; /* Number of elements in "output". */ size_t backlog; + + /* send retry times */ + int retries; }; /* Rate limit for error messages. */ @@ -127,10 +130,17 @@ jsonrpc_run(struct jsonrpc *rpc) ofpbuf_delete(buf); } } else { - if (retval != -EAGAIN) { - VLOG_WARN_RL(&rl, "%s: send error: %s", - rpc->name, ovs_strerror(-retval)); + if (retval != -EAGAIN || rpc->retries++ > 256) { + VLOG_WARN_RL(&rl, "%s: send error - %s: %s", + rpc->name, + retval != -EAGAIN ? "not again" : "over retries", + ovs_strerror(-retval)); jsonrpc_error(rpc, -retval); + } else { + VLOG_DBG_RL(&rl, "%s: send again: %s, retries %d", + rpc->name, + ovs_strerror(-retval), + rpc->retries); } break; } @@ -503,6 +513,7 @@ jsonrpc_cleanup(struct jsonrpc *rpc) ofpbuf_list_delete(&rpc->output); rpc->backlog = 0; rpc->output_count = 0; + rpc->retries = 0; } static struct jsonrpc_msg * -- 1.9.5.msysgit.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
