[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3301: allmydata.test.test_system.Connections.test_rref can fail with "Address already in use."

Tahoe-LAFS trac at tahoe-lafs.org
Tue Apr 14 12:52:26 UTC 2020


#3301: allmydata.test.test_system.Connections.test_rref can fail with "Address
already in use."
-------------------------+-----------------------
     Reporter:  exarkun  |      Owner:
         Type:  defect   |     Status:  new
     Priority:  normal   |  Milestone:  undecided
    Component:  unknown  |    Version:  n/a
   Resolution:           |   Keywords:
Launchpad Bug:           |
-------------------------+-----------------------

Comment (by exarkun):

 One possibly cause for this is the "main" Tub.  If the node configuration
 gives no explicit listen address, the initialization code for this Tub
 falls back to `allmydata.util.iputil.allocate_tcp_port` which is known to
 result in this kind of failure.

 From discussion with meejah on IRC, here's one possible solution.

 Add methods to `_Config` for getting the configured tub location/endpoint.
 Use these methods in `_tub_portlocation` instead of going directly to
 `get_config`.  Implement these in a way that makes it easy to substitute
 alternate values for the result.

 Add a new `create_client_for_test` helper which is similar to
 `allmydata.client.create_client` but which loads the configuration and
 then pokes test-friendly results for tub location/endpoint into the
 `_Config` object.  Then it calls `create_client_from_config` with this
 modified `_Config` object.

 Last, change most or all of the test suite callers of `create_client` to
 use `create_client_for_test` instead.  All tests modified this way will
 switch from using `_tub_portlocation`'s failure-prone `allocate_tcp_port`
 to using the less failure-prone port allocation scheme that is available
 to the test suite, `SameProcessStreamEndpointAssigner`.

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3301#comment:1>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list