summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-04-04 10:59:19 -0700
committerBen Pfaff <blp@nicira.com>2011-04-04 10:59:19 -0700
commitaacea8ba432bdffcca77696ba407be0c62661394 (patch)
tree2341fa0abe8ee9c6406b427ca6a67c5789780cae /tests
parent00c08589876b7c1cd8f57e5ebb3e66bb164c5a3d (diff)
downloadopenvswitch-aacea8ba432bdffcca77696ba407be0c62661394.tar.gz
daemon: Avoid races on pidfile creation.
Until now, if two copies of one OVS daemon started up at the same time, then due to races in pidfile creation it was possible for both of them to start successfully, instead of just one. This was made worse when a previous copy of the daemon had died abruptly, leaving a stale pidfile. This commit implements a new pidfile creation and removal protocol that I believe closes these races. Now, a pidfile is asserted with "link" instead of "rename", which prevents the race on creation, and a stale pidfile may only be deleted by a process after it has taken a lock on it. This may solve mysterious problems seen occasionally on vswitch restart. I'm still puzzled by these problems, however, because I don't see anything in our tests cases that would actually cause two copies of a daemon to start at the same time, which as far as I can see is a necessary precondition for the problem.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-daemon.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test-daemon.py b/tests/test-daemon.py
index 586e0ec36..350b8f703 100644
--- a/tests/test-daemon.py
+++ b/tests/test-daemon.py
@@ -13,6 +13,7 @@
# limitations under the License.
import getopt
+import logging
import signal
import sys
import time
@@ -24,6 +25,7 @@ def handler(signum, frame):
raise Exception("Signal handler called with %d" % signum)
def main(argv):
+ logging.basicConfig(level=logging.DEBUG)
signal.signal(signal.SIGHUP, handler)