This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new 9b62e2056 fix(triple): harden openServer against config errors (#2945)
9b62e2056 is described below
commit 9b62e205619f1894a6394db07d3610527071d678
Author: marsevilspirit <[email protected]>
AuthorDate: Fri Jul 11 13:19:09 2025 +0800
fix(triple): harden openServer against config errors (#2945)
* fix(triple): improve robustness of openServer against config errors
* fix(triple): compatible with old triple
* feat(triple): change some debug log output to warning
---
protocol/triple/triple.go | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/protocol/triple/triple.go b/protocol/triple/triple.go
index 86c4e58d5..538d67d57 100644
--- a/protocol/triple/triple.go
+++ b/protocol/triple/triple.go
@@ -85,10 +85,17 @@ func (tp *TripleProtocol) openServer(invoker base.Invoker,
info *common.ServiceI
panic("[TRIPLE Protocol]" + url.Key() + "is not existing")
}
- // TODO: handle errors
- tripleConfRaw, _ := url.GetAttribute(constant.TripleConfigKey)
- // TODO: verificate the tripleConf
- tripleConf, _ := tripleConfRaw.(*global.TripleConfig)
+ tripleConfRaw, ok := url.GetAttribute(constant.TripleConfigKey)
+ if !ok {
+ // NOTE: sometimes happened on old triple
+ logger.Warnf("Triple config is not found for url: %s",
url.Key())
+ }
+
+ tripleConf, ok := tripleConfRaw.(*global.TripleConfig)
+ if !ok || tripleConf == nil {
+ // NOTE: sometimes happened on old triple
+ logger.Warnf("Triple config obtained from url: %s is not of
type *global.TripleConfig or is nil", url.Key())
+ }
srv := NewServer(tripleConf)
srv.Start(invoker, info)