diff options
| author | Bitflash <btf01@proton.me> | 2026-08-02 12:14:42 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-02 12:14:42 -0300 |
| commit | 00c2d6af83c553df90e5950cf68552752b7ae6e7 (patch) | |
| tree | b9cd693bde2337c0b7954acf5e044f7c1693be0d /src | |
| parent | 758ff4bc49af78b06e37fc1e99741cb5fa8e43d6 (diff) | |
net: back to one accept thread until every relay takes more than one (#114)
#113 added three accept threads and called the extras harmless against an un-upgraded relay. They are not: an old relay closes the previous registration whenever the same node registers again, so the threads evict each other in a loop. Measured on the live network -- the node whose registrations landed on the un-upgraded New Jersey relay made 189 registrations in fifteen minutes with zero pairings, unreachable through it and hammering it, while the node on the upgraded relay made 9 with 7 pairings. One relay of three is upgraded, so this would hit two thirds of every node's registrations.
The relay half of #113 stays; it is compatible in both directions and is the prerequisite for raising this again, which the comment now states.
Diffstat (limited to 'src')
| -rw-r--r-- | src/net.h | 26 |
1 files changed, 21 insertions, 5 deletions
| @@ -54,11 +54,27 @@ static const int64 PEX_MIN_INTERVAL = 60; | |||
| 54 | // traffic is nothing: one per relay per five minutes. | 54 | // traffic is nothing: one per relay per five minutes. |
| 55 | static const int BTF_RENDEZVOUS_WAIT_SECS = 300; | 55 | static const int BTF_RENDEZVOUS_WAIT_SECS = 300; |
| 56 | 56 | ||
| 57 | // Registrations this node parks at a rendezvous at once. One is what the | 57 | // Registrations this node parks at a rendezvous at once. |
| 58 | // protocol needs; more is what keeps the node reachable while one of them is | 58 | // |
| 59 | // being paired, since pairing consumes the registration it used. Four matches | 59 | // Back to one, and it stays at one until every relay in vBtfMeetingRelays runs |
| 60 | // the relay's ceiling per node. | 60 | // the queue from #113. More than one is what keeps a node reachable while one |
| 61 | static const int BTF_ACCEPT_THREADS = 3; | 61 | // registration is being paired -- but only against a relay that accepts more |
| 62 | // than one. An older relay closes the previous registration whenever the same | ||
| 63 | // node registers again, so several accept threads pointed at one of those | ||
| 64 | // evict each other in a loop: thread 2 registers and kills thread 1, thread 3 | ||
| 65 | // kills thread 2, thread 1 sees its socket die and kills thread 3. | ||
| 66 | // | ||
| 67 | // #113 called that harmless. It is not. Measured on a node running three | ||
| 68 | // threads against the un-upgraded New Jersey relay: 189 registrations in about | ||
| 69 | // fifteen minutes -- roughly twelve a minute -- and not one pairing. The node | ||
| 70 | // was not merely failing to benefit, it was unreachable through that relay and | ||
| 71 | // hammering it. A node with one thread does none of this. | ||
| 72 | // | ||
| 73 | // The bench that approved #113 could not see it: its harness re-registers by | ||
| 74 | // design, which is exactly what hides an eviction loop. | ||
| 75 | // | ||
| 76 | // Raise this to 3 only when the other two relays are upgraded. | ||
| 77 | static const int BTF_ACCEPT_THREADS = 1; | ||
| 62 | 78 | ||
| 63 | // Liveness of an established peer connection. BTF_RENDEZVOUS_WAIT_SECS bounds | 79 | // Liveness of an established peer connection. BTF_RENDEZVOUS_WAIT_SECS bounds |
| 64 | // the wait for a dial to arrive; these bound the connection that comes out of | 80 | // the wait for a dial to arrive; these bound the connection that comes out of |