From: Ben Pfaff Date: Fri, 15 Jan 2010 23:22:54 +0000 (-0800) Subject: idl: Gracefully handle destroying a transaction before receiving its reply. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5a80c70c135a8c71969717cc7c4b06e6e7b715b;p=openvswitch idl: Gracefully handle destroying a transaction before receiving its reply. 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. --- diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index a4407a57..4f547330 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);