Commit cb9ce2d
committed
v1.9.1-rc2
Release candidate 2. The headline fix is the relay-flag flap that
caused "pings work for a minute then dial timeout for minutes" against
NAT'd peers (most commonly GCP service agents).
### Relay-flag flap (the "ping dies after a minute" bug)
clearRelayOnDirectLocked auto-flipped the relay flag back to direct
after 3 non-beacon-sourced packets. In production, that "non-beacon"
detection was unreliable: GCP NAT-port-rewrite of beacon-originated
UDP, beacon-mesh forwards from a different IP, and stray punch/ICMP
replies all looked non-beacon to the IP+port equality check. After
the flip, writeFrame happily sent to the unreachable direct address
and only the silent-detection 60 s later flipped back to relay —
during which encrypted sends dropped and rekey rotated session keys
faster than they could settle.
Fixes:
* pkg/daemon/tunnel.go: clearRelayOnDirectLocked auto-recovery
disabled. Once a peer is on relay, only explicit operator action
(SetRelayPeer(node, false)) clears the flag.
* pkg/daemon/tunnel.go: handleAuthKeyExchange + handleKeyExchange now
ALWAYS overwrite tm.peers[X] to the beacon and set+pin the relay
flag when fromRelay=true, regardless of whether ensureTunnel
pre-registered the peer with its registry-published direct address.
The old "only if unknown" gate (issue #199) left relayPeers[X]=false
for peers that ensureTunnel had pre-registered → writeFrame sent to
unreachable direct addr → 60 s silent before flip.
* pkg/daemon/tunnel.go: new relayPinned map. SetRelayPeerPinned()
marks the relay flag as authoritative — registry relay_only=true,
dial-time direct-failure switch, ICMP-unreachable threshold, and
beacon-sourced key exchanges all pin. Pinned peers cannot be
auto-cleared. Wired into the four call sites that flip to relay.
### Performance — pilotctl cold latency
* pkg/daemon/ipc.go: hostname cache (60 s) on the resolve_hostname IPC
handler. Persisted to ~/.pilot/hostname_cache.json so daemon restart
starts warm. Async resolve prewarm after a successful lookup so the
follow-up DialAddr skips the second registry round-trip.
* pkg/daemon/policy_runner.go: fetchMembers exponential backoff
(5 s → 10 s → ... → 5 min cap) so a doomed list_nodes no longer
holds the regConn mutex every 5 s and starves co-tenant calls.
* pkg/daemon/daemon.go: DialInitialRTO 1 s → 250 ms. Three direct
retries now total ~1.75 s before relay flip (was ~7 s).
* cmd/pilotctl/main.go: PILOTCTL_TRACE_TIME=1 env flag dumps per-step
timings to stderr for latency debugging.
Result: send-message 10–30 s → ~600 ms cold / ~170 ms warm.
pilotctl ping list-agents holds for 10+ minutes; previous
builds dropped after ~60–90 s.
### Other
* pkg/daemon/tunnel.go: ErrPendingDropped sentinel. DialConnection
no longer aborts when a SYN is queued during tunnel-handshake
startup — falls through to its existing 6-retry loop instead.
* cmd/pilotctl/main.go: classifyDaemonError() recognizes pending-
queue and dial-timeout patterns and surfaces an actionable hint
instead of generic "check ping" boilerplate.
* cmd/pilotctl/main.go: pilotctl ping SetReadDeadline before the
echo read so a relay-degraded peer reports timeout instead of
hanging forever.
* pkg/skillinject: config-file overlay support for skill paths.1 parent 2f880f9 commit cb9ce2d
11 files changed
Lines changed: 546 additions & 104 deletions
File tree
- cmd/pilotctl
- pkg
- daemon
- skillinject
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
12 | 117 | | |
13 | 118 | | |
14 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4315 | 4315 | | |
4316 | 4316 | | |
4317 | 4317 | | |
| 4318 | + | |
| 4319 | + | |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
| 4328 | + | |
| 4329 | + | |
4318 | 4330 | | |
| 4331 | + | |
4319 | 4332 | | |
4320 | 4333 | | |
4321 | 4334 | | |
| 4335 | + | |
4322 | 4336 | | |
4323 | 4337 | | |
4324 | 4338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
809 | 833 | | |
810 | 834 | | |
811 | 835 | | |
| |||
2509 | 2533 | | |
2510 | 2534 | | |
2511 | 2535 | | |
2512 | | - | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
2513 | 2544 | | |
2514 | 2545 | | |
2515 | | - | |
| 2546 | + | |
2516 | 2547 | | |
2517 | 2548 | | |
2518 | 2549 | | |
| |||
3272 | 3303 | | |
3273 | 3304 | | |
3274 | 3305 | | |
3275 | | - | |
3276 | | - | |
3277 | | - | |
3278 | | - | |
3279 | | - | |
3280 | | - | |
3281 | | - | |
3282 | | - | |
3283 | | - | |
3284 | | - | |
3285 | | - | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
3286 | 3309 | | |
3287 | | - | |
3288 | | - | |
3289 | | - | |
3290 | | - | |
3291 | | - | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
3292 | 3321 | | |
3293 | 3322 | | |
3294 | 3323 | | |
3295 | 3324 | | |
3296 | | - | |
| 3325 | + | |
3297 | 3326 | | |
3298 | 3327 | | |
3299 | 3328 | | |
| |||
3303 | 3332 | | |
3304 | 3333 | | |
3305 | 3334 | | |
3306 | | - | |
| 3335 | + | |
3307 | 3336 | | |
3308 | 3337 | | |
3309 | 3338 | | |
3310 | 3339 | | |
3311 | 3340 | | |
3312 | 3341 | | |
3313 | | - | |
| 3342 | + | |
| 3343 | + | |
3314 | 3344 | | |
3315 | 3345 | | |
3316 | 3346 | | |
3317 | 3347 | | |
3318 | | - | |
3319 | | - | |
3320 | | - | |
3321 | | - | |
3322 | 3348 | | |
| 3349 | + | |
3323 | 3350 | | |
3324 | | - | |
| 3351 | + | |
3325 | 3352 | | |
3326 | 3353 | | |
3327 | 3354 | | |
3328 | 3355 | | |
3329 | | - | |
| 3356 | + | |
3330 | 3357 | | |
3331 | 3358 | | |
3332 | 3359 | | |
| |||
3508 | 3535 | | |
3509 | 3536 | | |
3510 | 3537 | | |
3511 | | - | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
| 3541 | + | |
| 3542 | + | |
| 3543 | + | |
3512 | 3544 | | |
3513 | 3545 | | |
3514 | 3546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
861 | 868 | | |
862 | 869 | | |
863 | 870 | | |
| |||
897 | 904 | | |
898 | 905 | | |
899 | 906 | | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
900 | 912 | | |
901 | 913 | | |
902 | 914 | | |
| |||
906 | 918 | | |
907 | 919 | | |
908 | 920 | | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
909 | 932 | | |
910 | 933 | | |
911 | 934 | | |
| |||
0 commit comments