#275 new defect

need more reliable way to determine when introducer is ready when started from a script (than polling for creation of introducer.furl)

Reported by: zooko Owned by: somebody
Priority: minor Milestone: undecided
Component: code-nodeadmin Version: 0.7.0
Keywords: introducer start Cc:
Launchpad Bug:

Description

Arc is writing a script to automatically create a Tahoe grid (in order to automatically test tahoe-fuse.py). He was confused by the fact that introducer.furl is only sometimes present after starting an introducer:

0 /home/arc/trunk/contrib/fuse$ rm -rf introducer_dir/;rm -rf client_dir;PATH=${PWD}/../../bin/:${PATH} ./fusetest.py 
introducer created in introducer_dir
STARTING /home/arc/trunk/contrib/fuse/introducer_dir
introducer node probably started
0 /home/arc/trunk/contrib/fuse$ ls introducer_dir/
logs  my_nodeid  private  tahoe-introducer.tac  twistd.pid
0 /home/arc/trunk/contrib/fuse$ rm -rf introducer_dir/;rm -rf client_dir;PATH=${PWD}/../../bin/:${PATH} ./fusetest.py 
introducer created in introducer_dir
STARTING /home/arc/trunk/contrib/fuse/introducer_dir
introducer node probably started
0 /home/arc/trunk/contrib/fuse$ ls introducer_dir/
introducer.furl  logs       private               twistd.pid
introducer.port  my_nodeid  tahoe-introducer.tac

This is related to #71 -- ""client node probably started""

Change History (5)

comment:1 Changed at 2008-01-14T17:33:12Z by warner

If there was no serious error (like missing libraries), there *will* be a introducer.furl present some time after starting the introducer, it's just a matter of when. "right away" is too soon.

You have a few options:

  • tail the logfile, watch for a message that indicates the introducer.furl file has been created. If there is not currently such a message, add one.
  • poll the directory every 100ms until the file exists and can be read and contains a valid furl. Since we write the furl with a newline, just wait until there's a complete line in the file.
  • wait one second and hope that was enough.

The src/allmydata/test/test_system.py test runs the introducer in the same process as the test harness, so it can do node.when_tub_ready() and get immediate notification. That isn't easy to do from outside the process.

In practical deployments, this doesn't matter, since the introducer is one of those long-running processes that is generally constructed and launched by a human, well before any clients need to learn the introducer.furl, so running 'tahoe start' and then manually doing 'cat introducer.furl' is sufficient. For an automated setup process written in python, I'd do the poll-every-10Hz thing. For one written in bash, I guess I'd do the same.

comment:2 Changed at 2008-02-06T02:16:28Z by warner

  • Priority changed from major to minor

comment:3 Changed at 2008-06-01T20:47:19Z by warner

  • Milestone changed from eventually to undecided

comment:4 Changed at 2011-05-21T16:28:35Z by davidsarah

  • Component changed from operational to code-nodeadmin
  • Keywords introducer start added
  • Summary changed from timing of creation of introducer.furl to need more reliable way to determine when introducer is ready when started from a script (than polling for creation of introducer.furl)

comment:5 Changed at 2017-09-19T17:20:49Z by Brian Warner <warner@…>

In 04b34b6/trunk:

Merge PR417: rewrite tahoe start/stop/daemonize

Note: See TracTickets for help on using tickets.