[ovs-dev] [v2 1/2] ovsdb: Warn about reaching max session limit

Russell Bryant rbryant at redhat.com
Tue Feb 24 18:19:32 UTC 2015


On 02/24/2015 06:58 PM, Andy Zhou wrote:
> Without the log message, it was not obvious why ovsdb-server no longer
> accepts new connections when the session limit was reached. This patch
> adds a log message to make it obvious.
> 
> Signed-off-by: Andy Zhou <azhou at nicira.com>
> 
> --
> v1->v2:
>        make sure ovsdb_jsonrpc_session_run_all() is always called.
> ---
>  ovsdb/jsonrpc-server.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
> index caef515..1092ffa 100644
> --- a/ovsdb/jsonrpc-server.c
> +++ b/ovsdb/jsonrpc-server.c
> @@ -314,20 +314,26 @@ ovsdb_jsonrpc_server_run(struct ovsdb_jsonrpc_server *svr)
>      SHASH_FOR_EACH (node, &svr->remotes) {
>          struct ovsdb_jsonrpc_remote *remote = node->data;
>  
> -        if (remote->listener && svr->n_sessions < svr->max_sessions) {
> +        if (remote->listener) {
>              struct stream *stream;
>              int error;

This is pretty pedantic, but you could now localize these variables to
the new if block you add below.  Otherwise:

Acked-by: Russell Bryant <rbryant at redhat.com>

>  
> -            error = pstream_accept(remote->listener, &stream);
> -            if (!error) {
> -                struct jsonrpc_session *js;
> -                js = jsonrpc_session_open_unreliably(jsonrpc_open(stream),
> -                                                     remote->dscp);
> -                ovsdb_jsonrpc_session_create(remote, js);
> -            } else if (error != EAGAIN) {
> -                VLOG_WARN_RL(&rl, "%s: accept failed: %s",
> +            if (svr->n_sessions < svr->max_sessions) {
> +                error = pstream_accept(remote->listener, &stream);
> +                if (!error) {
> +                    struct jsonrpc_session *js;
> +                    js = jsonrpc_session_open_unreliably(jsonrpc_open(stream),
> +                                                         remote->dscp);
> +                    ovsdb_jsonrpc_session_create(remote, js);
> +                } else if (error != EAGAIN) {
> +                    VLOG_WARN_RL(&rl, "%s: accept failed: %s",
> +                                 pstream_get_name(remote->listener),
> +                                 ovs_strerror(error));
> +                }
> +            } else {
> +                VLOG_WARN_RL(&rl, "%s: connection exceeded maximum (%d)",
>                               pstream_get_name(remote->listener),
> -                             ovs_strerror(error));
> +                             svr->max_sessions);
>              }
>          }
>  
> 


-- 
Russell Bryant



More information about the dev mailing list