From f124daf5a37c3b968a618f92ca42396f3c001de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Wed, 26 Aug 2026 02:30:33 +0800 Subject: [PATCH] Observatory: Fix consuming 100% CPU when no outbound matches `subjectSelector` (#6669) Fixes https://github.com/XTLS/Xray-core/issues/6666 --- app/observatory/observer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/observatory/observer.go b/app/observatory/observer.go index 80d81e227..29cc86f63 100644 --- a/app/observatory/observer.go +++ b/app/observatory/observer.go @@ -78,6 +78,12 @@ func (o *Observer) background() { sleepTime = time.Duration(o.config.ProbeInterval) } + if len(outbounds) == 0 { + errors.LogWarning(o.ctx, "no outbound matches subjectSelector ", o.config.SubjectSelector) + time.Sleep(sleepTime) + continue + } + if !o.config.EnableConcurrency { sort.Strings(outbounds) for _, v := range outbounds {