[ovs-dev] [daemon 00/10] avoid races in daemonization

Ben Pfaff blp at nicira.com
Thu Mar 31 23:31:23 UTC 2011


At Nicira we have an internal test suite that restarts the vswitch a
lot, by calling "/etc/init.d/openvswitch restart".  Once in a while,
we end up with zero copies of a daemon after this runs, or with two
copies of a daemon.  Obviously this isn't good.  I can't figure out
how it would happen.  We're not running restarts in parallel, so it
shouldn't be a race between two separate restarts, and there's nothing
very special going on on these boxes.

I don't know that this series fixes the problem, because I don't know
exactly what the problem is.  But it should at least nail down some
of the possible offenders, and I hope that at least the increased
logging added in various places makes the problem easier to track down
should it keep occurring.

Ben Pfaff (10):
  stream-ssl: Use out_of_memory() to abort due to lack of memory.
  vlog: Use PRINTF_FORMAT macro from compiler.h.
  Add a few more users for ovs_retval_to_string().
  type-props: New macro for estimating length of a decimal integer.
  signals: New function signal_name().
  util: New function ovs_fatal_valist().
  Log anything that could prevent a daemon from starting.
  daemon: Tolerate EINTR in fork_and_wait_for_startup().
  daemon: Integrate checking for an existing pidfile into
    daemonize_start().
  daemon: Avoid races on pidfile creation.

 debian/ovs-monitor-ipsec                           |    4 +-
 lib/command-line.c                                 |   19 +-
 lib/daemon.c                                       |  278 ++++++++++++--------
 lib/daemon.h                                       |    1 -
 lib/entropy.c                                      |    8 +-
 lib/fatal-signal.c                                 |   13 +-
 lib/ovsdb-error.c                                  |   10 +-
 lib/process.c                                      |   38 +--
 lib/random.c                                       |    7 +-
 lib/signals.c                                      |   52 ++++-
 lib/signals.h                                      |    8 +-
 lib/socket-util.c                                  |    7 +
 lib/socket-util.h                                  |    4 +-
 lib/stream-ssl.c                                   |    3 +-
 lib/timeval.c                                      |   25 +-
 lib/timeval.h                                      |    4 +-
 lib/type-props.h                                   |    9 +-
 lib/unixctl.c                                      |    5 +-
 lib/util.c                                         |    9 +-
 lib/util.h                                         |    2 +
 lib/uuid.c                                         |    7 +-
 lib/vlog.c                                         |   27 ++-
 lib/vlog.h                                         |   20 ++-
 ovsdb/ovsdb-server.c                               |    1 -
 python/ovs/daemon.py                               |  201 +++++++++------
 tests/ovsdb-log.at                                 |    2 +-
 tests/test-daemon.py                               |    5 +-
 tests/test-jsonrpc.c                               |    2 -
 tests/test-jsonrpc.py                              |    4 +-
 tests/test-timeval.c                               |    4 +-
 tests/test-type-props.c                            |   13 +-
 utilities/ovs-controller.c                         |    1 -
 utilities/ovs-dpctl.c                              |   11 +-
 utilities/ovs-ofctl.c                              |   19 +-
 utilities/ovs-openflowd.c                          |   45 ++--
 vswitchd/ovs-brcompatd.c                           |   19 +-
 vswitchd/ovs-vswitchd.c                            |    5 +-
 .../usr_share_openvswitch_scripts_ovs-xapi-sync    |    2 -
 38 files changed, 530 insertions(+), 364 deletions(-)




More information about the dev mailing list