Commit cc5a12d
fix(consul-postgres-ha): partial — cancel in-flight ICE dial on fresher peer auth
Approach 2 from the hot-patch flakiness investigation: extend
peerSession with the consumed (ufrag, pwd) and the dialCtx cancel
fn under a mutex; in pollLoop's auth handler, if dialICE has
already consumed earlier auth (cancelDial != nil) and the new auth
differs from what was consumed, cancel the in-flight dial so
runPeerLink's 5s retry re-enters dialICE with a fresh agent.
Verified live this catches the race: during a hot-patch experiment
on a 6-CVM cluster, two cancellations fired immediately after
worker-3 came back up:
[worker-5] fresh auth (ufrag=dTTgJQtAWZDKXQoq) supersedes
consumed (ufrag=GqdAyDeiuscgMTgN) — cancelling stale dial
[coordinator-1] fresh auth (ufrag=tlqpstQTsxAneeab) supersedes
consumed (ufrag=hJcjbvQIbtmKzGBs) — cancelling stale dial
So the race is real and the fix detects it correctly.
But this is NOT a complete fix for the hot-patch flakiness — after
the cancels, the cluster still didn't re-converge: ICE handshakes
run to their 30s connectivity-check timeout despite both sides
having mutually-current auth. Verified across 30+ minutes on the
live cluster: only 2 cancel events the entire time, and the
subsequent dial cycles all fail without further fresh-auth events
to cancel. So there's a second failure mode (possibly a coturn
permission staleness, dstack-edge NAT mapping rotation, or pion
ICE state-machine quirk in relay-only mode) that approach 2
doesn't reach. Pion debug logging is the next step to pin it down.
Keeping this commit because the fix is a real improvement against a
real bug — just not the full hot-patch story.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f8ae0ab commit cc5a12d
1 file changed
Lines changed: 61 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
847 | 862 | | |
848 | 863 | | |
849 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
850 | 869 | | |
851 | 870 | | |
852 | 871 | | |
| |||
965 | 984 | | |
966 | 985 | | |
967 | 986 | | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
968 | 996 | | |
969 | 997 | | |
970 | 998 | | |
| |||
1056 | 1084 | | |
1057 | 1085 | | |
1058 | 1086 | | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1065 | 1119 | | |
1066 | 1120 | | |
1067 | 1121 | | |
1068 | 1122 | | |
1069 | | - | |
| 1123 | + | |
1070 | 1124 | | |
1071 | 1125 | | |
1072 | 1126 | | |
| |||
0 commit comments