Alanxtl commented on code in PR #3301:
URL: https://github.com/apache/dubbo-go/pull/3301#discussion_r3127968088
##########
server/server.go:
##########
Review Comment:
`Serve` now calls `hostAttachedHTTPHandler()` before `exportServices()`. In
the attach-first path that reaches `HostHTTPHandler -> StartHTTPTransport`, the
Triple listener is started in a background goroutine immediately; if any later
step in `exportServices`, `exportInternalServices`, or service-instance
registration fails, `Serve()` returns an error but never tears that listener
back down. Before this PR, startup errors happened before any listener was
started, so this is a behavioral regression that can leave a partially started
server still accepting HTTP traffic after `Serve()` reports failure.
##########
protocol/triple/triple.go:
##########
@@ -95,40 +96,43 @@ func (tp *TripleProtocol) Export(invoker base.Invoker)
base.Exporter {
exporter := NewTripleExporter(serviceKey, invoker, tp.ExporterMap())
tp.SetExporterMap(serviceKey, exporter)
logger.Infof("[TRIPLE Protocol] Export service: %s", url.String())
- tp.openServer(invoker, info)
- internal.HealthSetServingStatusServing(serviceKey)
+ if err := tp.openServer(invoker, info); err != nil {
+ logger.Errorf("[TRIPLE Protocol] Export service failed: %s,
err: %v", url.String(), err)
+ exporter.UnExport()
+ panic(err)
+ }
+ internal.HealthSetServingStatusServing(url.Service())
Review Comment:
`Export` used to mark a Triple service as SERVING with `url.ServiceKey()`,
which matches both the exporter map and the shutdown path. This change switches
the key to `url.Service()`, but `Check` still looks up the exact requested
service string and shutdown still writes NOT_SERVING under `serviceKey`. In
practice, health checks for versioned/grouped services can stay `unknown
service` even after a successful export, and the SERVING/NOT_SERVING updates no
longer target the same entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]