Aias00 commented on code in PR #995:
URL: https://github.com/apache/dubbo-go-pixiu/pull/995#discussion_r3565778342


##########
admin/core/server.go:
##########
@@ -83,4 +87,5 @@ func RunServer() {
        })
 
        wg.Wait()
+       return nil

Review Comment:
   Fixed in `e6a14199`.
   
   Worker startup errors now propagate to the CLI. The HTTP server and xDS 
server run under a new `runCoordinated(ctx, ...workers)` harness: the first 
worker to return a non-nil error cancels its peer and that error is returned by 
`RunServer`. Concretely:
   
   - `runHTTPServer` returns `ListenAndServe` failures (e.g. port already in 
use), wrapped as `"http server: %w"`, instead of only logging.
   - `StartxDsServer(ctx)` / `runXDSServer(ctx, ...)` take the context; the 
initial `net.Listen` error (port-bind failure) is returned, and on peer-cancel 
the gRPC server does `GracefulStop()` with the `Serve` error drained.
   - The HTTP peer shuts down via `http.Server.Shutdown(ctx)` when the xDS 
server fails (first real `ErrServerClosed` trigger in the package), so neither 
worker lingers and the process exits non-zero instead of hanging on `wg.Wait()`.
   
   Tests added in `admin/core/server_test.go`: 
`TestRunCoordinated_FirstErrorWins`, 
`TestRunCoordinated_OnlyFirstErrorPropagated`, 
`TestRunCoordinated_NoErrorReturnsNil`, 
`TestRunCoordinated_ParentCancelPropagates`, and 
`TestRunXDSServer_PortBindFailure` (occupies a port on all interfaces, asserts 
`runXDSServer` returns the bind error rather than hanging).
   
   Side effect: drops the `v.marlon.life/toolkit/util` (`WaitGroupWrapper`) 
fork dependency from `server.go` in favor of `sync.WaitGroup` + `context`, 
aligning with develop (PR #984).
   
   `go build`, `go vet`, `go test -race`, `gofmt`, and `golangci-lint` are all 
clean on `admin/core` and `cmd/admin`.



-- 
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]

Reply via email to