[ovs-git] Open vSwitch: ovsdb-idl: Prevent occasional hang when multiple database clients race. (branch-1.3)

dev at openvswitch.org dev at openvswitch.org
Mon Oct 31 16:49:46 UTC 2011

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, branch-1.3 has been updated
       via  c34377e246867b8d81fc6ae7f945186db2e58d04 (commit)
      from  ce01b7362980a02753f8ff5a8072d37909ec4907 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c34377e246867b8d81fc6ae7f945186db2e58d04
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=c34377e246867b8d81fc6ae7f945186db2e58d04
Author: Ben Pfaff <blp at nicira.com>
ovsdb-idl: Prevent occasional hang when multiple database clients race.
When a client of the IDL tries to commit a read-modify-write transaction
but the database has changed in the meantime, the IDL tells its client to
wait for the IDL to change and then try the transaction again by returning
TXN_TRY_AGAIN.  The "wait for the IDL to change" part is important because
there's no point in retrying the transaction before the IDL has received
the database updates (the transaction would fail in the same way all over

However, the logic was incomplete: the database update can be received
*before* the reply to the transaction RPC (I think that in the current
ovsdb-server implementation this will always happen, in fact).  When this
happens, the right thing to do is to retry the transaction immediately;
if we wait, then we're waiting for an additional change to the database
that may never come, causing an indefinite hang.

This commit therefore breaks the "try again" IDL commit status code
into two, one that means "try again immediately" and another that means
"wait for a change then try again".  When an update is processed after a
transaction is committed but before the reply is received, the "try again
now" tells the IDL client not to wait for another database change before
retrying its transaction.

Bug #5980.
Reported-by: Ram Jothikumar <rjothikumar at nicira.com>
Reproduced-by: Alex Yip <alex at nicira.com>


Summary of changes:
 lib/ovsdb-idl.c       |   20 ++++++++++++++------
 lib/ovsdb-idl.h       |    6 ++++--
 python/ovs/db/idl.py  |   21 +++++++++++++++------
 tests/ovsdb-idl.at    |    2 +-
 utilities/ovs-vsctl.c |   26 +++++++++++++++++---------
 5 files changed, 51 insertions(+), 24 deletions(-)

Open vSwitch

More information about the git mailing list