[ovs-dev] [PATCH 2/2] idl: Gracefully handle destroying a transaction before receiving its reply.

Justin Pettit jpettit at nicira.com
Fri Jan 15 23:28:34 UTC 2010


Another fun one to track down.  Looks good.

--Justin


On Jan 15, 2010, at 3:23 PM, Ben Pfaff wrote:

> If ovsdb_idl_txn_destroy() is called to destroy a transaction before its
> reply has been received from the database server, then until now we would
> drop the connection to the database when the reply actually arrived,
> because we would have no record of that transaction ID any longer.
> 
> Notably, ovs-vswitchd does this: it "fires and forgets" database
> transactions.  (Really, it should not do that, but that's a bigger commit.)
> 
> This commit fixes the problem by not dropping the database connection in
> such a case.
> 
> This fixes an observed problem such that sometimes ovs-vsctl took a long
> time to complete, which was because ovs-vswitchd was dropping its
> connection to the database and backing off.
> ---
> lib/ovsdb-idl.c |   10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index a4407a5..4f54733 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -266,10 +266,12 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
>                    && ovsdb_idl_txn_process_reply(idl, msg)) {
>             /* ovsdb_idl_txn_process_reply() did everything needful. */
>         } else {
> -            VLOG_WARN("%s: received unexpected %s message",
> -                      jsonrpc_session_get_name(idl->session),
> -                      jsonrpc_msg_type_to_string(msg->type));
> -            jsonrpc_session_force_reconnect(idl->session);
> +            /* This can happen if ovsdb_idl_txn_destroy() is called to destroy
> +             * a transaction before we receive the reply, so keep the log level
> +             * low. */
> +            VLOG_DBG("%s: received unexpected %s message",
> +                     jsonrpc_session_get_name(idl->session),
> +                     jsonrpc_msg_type_to_string(msg->type));
>         }
>         if (reply) {
>             jsonrpc_session_send(idl->session, reply);
> -- 
> 1.6.3.3
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list