#2795 closed defect (fixed)

copy fixed allocate_tcp_port() from Foolscap

Reported by: warner Owned by: warner
Priority: normal Milestone: 1.12.0
Component: code Version: 1.11.0
Keywords: Cc:
Launchpad Bug:

Description

The synchronous node startup work (#2491) used a function I wrote for Foolscap, named allocate_tcp_port(), which.. wait for it.. allocates a TCP port. But it had a bug, which occasionally (maybe 1 out of 5000 trials) returns a port which is actually in use, which causes an EADDRINUSE when you try to listen on it. Given the number of port allocations performed by the unit test suite, I think this was causing spurious failures in maybe 2-5% of test runs.

Foolscap#258 fixes the bug (the details are platform-specific). So the task is just to copy the updated function over into src/allmydata/util/iputil.py.

Change History (2)

comment:1 Changed at 2016-07-07T02:52:04Z by Brian Warner <warner@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 3402f75/trunk:

copy fixed allocate_tcp_port() from foolscap

The old copy had a bug which occasionally returns a port that was
actually in use, causing intermittent test failures (when large numbers
of ports were allocated). I finally figured out how to fix it in
Foolscap, so this is just a copy of the updated function.

closes ticket:2795

comment:2 Changed at 2016-09-02T06:04:11Z by Brian Warner <warner@…>

In 57e7f7b/trunk:

import/delegate-to foolscap's allocate_tcp_port

(instead of using a copy). Foolscap-0.12.3 fixes a problem with
allocate_tcp_port() that was causing intermittent test failures. I think
it makes more sense to use Foolscap's copy (and fixes) than to keep
re-copying it into Tahoe each time it changes.

If/when we manage to stop depending upon foolscap for server RPC, we can
re-copy this back into tahoe's source tree.

refs ticket:2795

Note: See TracTickets for help on using tickets.