Ali Karami
1edb8b31bc
fix(xray): keep balancer overrides across routing reloads ( #6779 )
...
* fix(xray): keep balancer overrides across routing reloads
A balancer override set from the panel lived only inside the running
core. Every routing hot-apply (any Xray-settings save touching rules or
balancers) and every node test through an outbound calls
RoutingService.AddRule with shouldAppend=false, which rebuilds all
balancers, so the override vanished silently even though the API docs
promised it lasted until an Xray restart.
The panel now records the overrides it sets, per core process, and
re-applies them after its own routing reloads. Targets are validated
against the running config: the core accepts any tag and then closes
every connection routed to one it lacks, so an unknown target is
refused, and an override whose outbound is removed is cleared instead
of black-holing the balancer. Balancer targets resolve to their _bl_
loopback from the running config rather than the saved template.
Restarting Xray still clears overrides, as documented.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01KrJrzn9LKaPhMq9h3Fb5TV
* fix(xray): serialize overrides and the node bridge with config applies
Review of #6779 found two races. Neither path took the package lock that
RestartXray holds while it changes the running core:
- An override landing mid hot-apply was checked against the config
snapshot the apply was replacing, so it could pin a balancer to an
outbound the core had just removed. OverrideBalancer now takes the lock.
- The node bridge's teardown checked overrides against the snapshot it
took before the probe, which can run for seconds, so it dropped an
override set meanwhile onto a newly saved outbound.
The same stale snapshot drove the bridge's routing restore. That restore
silently reverted rule changes saved during a probe. After a restart, it
also pushed the old core's rules and overrides into the new core through
the shared API port. The bridge is now built and torn down under the lock,
which is not held while the probe runs. At teardown it restores the
routing that the core's config holds then, and it leaves alone a core that
was restarted meanwhile.
With every caller under the package lock, balancerOverrideSet drops its
own mutex.
2026-10-12 14:59:26 +02:00
..
2026-09-27 03:04:50 +02:00
2026-09-27 03:04:50 +02:00
2026-10-11 10:31:01 +02:00
2026-10-11 10:28:49 +02:00
2026-10-02 23:56:52 +02:00
2026-10-03 01:35:13 +02:00
2026-07-17 00:33:06 +02:00
2026-08-15 16:50:20 +02:00
2026-06-27 12:08:20 +02:00
2026-09-27 03:04:50 +02:00
2026-07-17 00:33:06 +02:00
2026-08-18 12:46:00 +02:00
2026-09-26 22:59:23 +02:00
2026-09-26 22:59:23 +02:00
2026-09-26 22:59:23 +02:00
2026-07-05 21:17:25 +02:00
2026-08-24 02:41:15 +02:00
2026-09-27 18:18:50 +02:00
2026-09-27 03:04:50 +02:00
2026-08-24 02:41:15 +02:00
2026-09-10 16:24:48 +02:00
2026-09-10 16:24:48 +02:00
2026-09-10 16:24:48 +02:00
2026-09-10 21:07:49 +02:00
2026-07-08 20:53:42 +02:00
2026-10-11 22:05:24 +02:00
2026-09-04 01:01:20 +02:00
2026-07-11 22:48:51 +02:00
2026-08-24 02:41:15 +02:00
2026-10-11 21:20:07 +02:00
2026-07-11 22:48:57 +02:00
2026-07-07 15:05:22 +02:00
2026-07-05 20:28:26 +02:00
2026-09-09 00:17:54 +02:00
2026-09-15 15:39:40 +03:00
2026-09-07 01:51:18 +02:00
2026-09-27 03:04:50 +02:00
2026-06-10 15:19:22 +02:00
2026-08-23 21:57:03 +02:00
2026-08-18 13:55:04 +02:00
2026-10-12 00:49:11 +02:00
2026-08-14 19:50:06 +02:00
2026-09-27 03:04:50 +02:00
2026-07-02 09:17:47 +02:00
2026-09-27 02:48:40 +02:00
2026-09-27 03:04:50 +02:00
2026-09-27 03:04:50 +02:00
2026-09-26 20:30:22 +02:00
2026-10-11 22:05:24 +02:00
2026-08-24 02:41:15 +02:00
2026-10-11 22:05:24 +02:00
2026-08-24 13:27:40 +02:00
2026-08-20 04:09:57 +02:00
2026-10-03 02:56:02 +02:00
2026-10-11 16:35:20 +02:00
2026-07-17 00:33:06 +02:00
2026-08-23 23:17:56 +02:00
2026-07-28 22:38:44 +02:00
2026-09-27 13:33:29 +02:00
2026-09-07 14:24:14 +02:00
2026-10-03 01:22:28 +02:00
2026-10-03 01:39:07 +02:00
2026-09-27 02:48:40 +02:00
2026-09-27 02:48:40 +02:00
2026-09-26 22:59:23 +02:00
2026-09-28 13:23:48 +02:00
2026-09-15 18:00:54 +03:00
2026-08-15 16:50:20 +02:00
2026-09-27 03:04:50 +02:00
2026-09-27 03:04:50 +02:00
2026-10-05 16:12:08 +02:00
2026-08-01 15:19:08 +02:00
2026-08-23 21:57:03 +02:00
2026-08-18 13:08:44 +02:00
2026-09-28 01:59:53 +02:00
2026-09-28 13:02:50 +02:00
2026-08-24 02:41:15 +02:00
2026-08-15 16:50:20 +02:00
2026-09-07 14:24:14 +02:00
2026-09-10 22:32:42 +02:00
2026-08-15 16:50:20 +02:00
2026-08-15 16:50:20 +02:00
2026-09-09 00:30:02 +02:00
2026-09-26 22:59:23 +02:00
2026-07-05 20:28:26 +02:00
2026-09-27 18:18:50 +02:00
2026-09-27 18:18:50 +02:00
2026-09-27 02:48:40 +02:00
2026-09-14 12:08:38 +02:00
2026-09-14 12:08:38 +02:00
2026-07-05 20:28:26 +02:00
2026-08-18 15:24:59 +02:00
2026-09-26 21:59:29 +02:00
2026-06-27 15:42:22 +02:00
2026-07-28 14:43:55 +02:00
2026-08-15 17:12:59 +02:00
2026-08-14 19:42:09 +02:00
2026-07-30 03:14:22 +02:00
2026-09-13 12:44:55 +02:00
2026-09-13 12:44:55 +02:00
2026-09-27 03:04:50 +02:00
2026-09-13 12:44:55 +02:00
2026-09-16 11:56:20 +02:00
2026-10-11 18:26:45 +02:00
2026-08-18 15:24:59 +02:00
2026-09-15 13:31:07 +03:00
2026-10-05 16:12:08 +02:00
2026-10-03 02:56:02 +02:00
2026-09-12 11:06:47 +02:00
2026-08-22 23:12:33 +02:00
2026-08-18 11:53:11 +02:00
2026-08-14 19:42:09 +02:00
2026-09-02 20:39:03 +02:00
2026-08-14 19:42:09 +02:00
2026-09-26 22:59:23 +02:00
2026-09-27 03:04:50 +02:00
2026-09-26 22:00:40 +02:00
2026-07-23 15:34:42 +02:00
2026-10-03 02:56:02 +02:00
2026-09-12 11:12:13 +02:00
2026-10-03 02:56:02 +02:00
2026-10-11 22:05:24 +02:00
2026-08-18 11:48:40 +02:00
2026-09-27 03:04:50 +02:00
2026-09-28 02:23:50 +02:00
2026-09-08 18:08:24 +02:00
2026-09-15 15:29:32 +03:00
2026-09-27 12:26:37 +02:00
2026-08-01 15:19:08 +02:00
2026-07-17 00:33:06 +02:00
2026-10-11 18:26:45 +02:00
2026-10-11 18:02:12 +02:00
2026-07-28 13:14:06 +02:00
2026-09-27 03:04:50 +02:00
2026-08-15 23:09:16 +02:00
2026-09-28 13:23:48 +02:00
2026-09-08 15:36:57 +02:00
2026-09-27 18:28:07 +02:00
2026-07-21 15:57:55 +02:00
2026-10-11 16:35:20 +02:00
2026-09-27 03:04:50 +02:00
2026-09-26 20:30:25 +02:00
2026-09-28 13:23:48 +02:00
2026-07-07 01:13:24 +02:00
2026-08-01 15:19:08 +02:00
2026-07-06 17:55:57 +02:00
2026-07-17 00:33:06 +02:00
2026-09-28 02:56:53 +02:00
2026-06-22 20:20:55 +02:00
2026-08-24 13:27:40 +02:00
2026-10-03 00:26:46 +02:00
2026-09-13 22:44:50 +02:00
2026-10-03 00:26:46 +02:00
2026-08-23 23:17:56 +02:00
2026-10-11 22:05:24 +02:00
2026-07-03 01:12:32 +02:00
2026-10-11 10:28:49 +02:00
2026-10-12 00:49:11 +02:00
2026-10-12 00:49:11 +02:00
2026-09-28 02:23:50 +02:00
2026-07-08 20:31:00 +02:00
2026-09-27 18:28:07 +02:00
2026-09-28 13:23:48 +02:00
2026-09-28 01:59:33 +02:00
2026-09-12 11:14:53 +02:00
2026-06-27 11:22:45 +02:00
2026-09-27 03:04:50 +02:00
2026-09-27 03:04:50 +02:00
2026-09-08 18:08:24 +02:00
2026-09-28 02:56:53 +02:00
2026-09-15 16:28:31 +02:00
2026-07-28 23:27:09 +02:00
2026-10-03 02:56:02 +02:00
2026-10-07 10:53:46 +02:00
2026-10-03 02:56:02 +02:00
2026-09-28 13:23:48 +02:00
2026-09-08 15:36:57 +02:00
2026-10-11 22:10:46 +02:00
2026-10-11 22:10:46 +02:00
2026-10-12 00:49:11 +02:00
2026-10-12 00:49:11 +02:00
2026-07-17 00:33:06 +02:00
2026-06-26 00:10:30 +02:00
2026-07-25 16:08:09 +02:00
2026-09-28 02:56:53 +02:00
2026-09-28 13:02:50 +02:00
2026-09-15 20:07:18 +02:00
2026-09-10 16:24:48 +02:00
2026-07-08 22:12:28 +02:00
2026-08-23 23:17:56 +02:00
2026-07-07 15:05:23 +02:00
2026-09-27 03:04:50 +02:00
2026-09-26 22:59:23 +02:00
2026-07-23 15:35:11 +02:00
2026-07-23 15:35:11 +02:00
2026-10-05 16:12:08 +02:00
2026-09-15 20:39:32 +02:00
2026-06-20 01:09:53 +02:00
2026-10-05 20:37:35 +02:00
2026-08-23 23:17:56 +02:00
2026-09-03 18:06:35 +02:00
2026-08-23 23:17:56 +02:00
2026-09-07 14:24:14 +02:00
2026-10-06 12:35:59 +02:00
2026-08-15 16:03:42 +02:00
2026-08-15 21:31:31 +02:00
2026-06-16 12:19:33 +02:00
2026-08-23 23:17:56 +02:00
2026-09-08 14:12:13 +02:00
2026-09-18 13:25:24 +03:00
2026-08-01 15:19:08 +02:00
2026-09-28 02:56:53 +02:00
2026-09-28 02:56:53 +02:00
2026-06-22 20:20:55 +02:00
2026-08-23 23:17:56 +02:00
2026-08-20 04:09:57 +02:00
2026-08-23 23:17:56 +02:00
2026-08-14 20:01:35 +02:00
2026-08-15 16:48:50 +02:00
2026-07-08 22:12:28 +02:00
2026-09-15 19:27:38 +02:00
2026-09-15 19:27:38 +02:00
2026-10-12 14:59:26 +02:00
2026-09-26 21:59:29 +02:00
2026-07-23 15:34:42 +02:00
2026-09-15 22:39:59 +02:00
2026-09-26 21:59:29 +02:00
2026-09-15 16:58:21 +03:00
2026-10-11 10:28:49 +02:00
2026-10-11 10:28:49 +02:00
2026-09-13 14:48:28 +02:00
2026-09-13 14:48:28 +02:00
2026-07-17 00:33:06 +02:00
2026-09-27 03:04:50 +02:00
2026-10-08 22:02:46 +02:00
2026-09-27 03:04:50 +02:00
2026-09-27 03:04:50 +02:00
2026-09-27 03:04:50 +02:00
2026-07-06 09:24:18 +02:00
2026-09-27 03:04:50 +02:00
2026-10-03 13:20:00 +02:00
2026-10-03 01:21:25 +02:00
2026-06-24 21:22:42 +02:00
2026-06-20 00:37:35 +02:00
2026-10-03 13:20:00 +02:00
2026-07-14 13:01:40 +02:00
2026-09-13 14:04:53 +02:00
2026-09-13 12:44:55 +02:00
2026-09-16 12:30:44 +02:00
2026-09-27 03:04:50 +02:00
2026-09-16 12:30:44 +02:00
2026-09-10 17:05:54 +02:00
2026-09-27 03:04:50 +02:00
2026-07-28 22:12:52 +02:00
2026-09-08 17:14:01 +02:00
2026-09-13 11:51:56 +02:00
2026-09-15 21:13:29 +02:00
2026-10-11 18:26:45 +02:00
2026-06-17 14:11:35 +02:00
2026-10-11 21:20:07 +02:00
2026-07-12 00:30:47 +02:00
2026-08-23 22:34:20 +02:00
2026-09-27 03:04:50 +02:00
2026-09-02 20:21:27 +02:00
2026-06-10 15:19:22 +02:00
2026-09-10 16:24:48 +02:00
2026-07-17 00:33:06 +02:00
2026-09-15 19:04:55 +02:00
2026-07-02 16:12:46 +02:00
2026-09-15 19:04:55 +02:00
2026-06-10 15:19:22 +02:00
2026-09-26 20:30:22 +02:00
2026-10-03 02:56:02 +02:00
2026-10-03 02:56:02 +02:00
2026-10-03 02:56:02 +02:00
2026-10-11 22:05:24 +02:00
2026-08-24 13:27:40 +02:00
2026-08-24 13:27:40 +02:00
2026-07-02 16:12:46 +02:00
2026-09-27 16:09:54 +02:00
2026-09-10 14:50:48 +02:00
2026-10-12 14:59:26 +02:00
2026-10-12 14:59:26 +02:00
2026-10-12 14:59:26 +02:00
2026-09-26 22:02:22 +02:00
2026-09-26 22:02:22 +02:00
2026-10-12 00:49:11 +02:00
2026-09-26 22:04:08 +02:00
2026-07-02 16:12:46 +02:00
2026-09-15 15:39:40 +03:00
2026-10-03 01:23:25 +02:00
2026-07-29 21:00:29 +02:00
2026-09-03 18:06:15 +02:00
2026-09-27 03:04:50 +02:00
2026-07-23 15:34:42 +02:00
2026-09-15 20:39:32 +02:00
2026-07-17 00:33:06 +02:00
2026-09-15 16:00:05 +02:00
2026-07-23 15:34:42 +02:00
2026-07-23 15:34:42 +02:00
2026-09-14 21:18:31 +03:00
2026-09-14 21:18:31 +03:00
2026-07-21 15:51:46 +02:00
2026-10-12 00:49:11 +02:00
2026-06-15 00:43:49 +02:00
2026-10-07 10:55:41 +02:00
2026-10-11 07:55:12 +02:00
2026-10-12 14:59:26 +02:00