lizining1231 opened a new pull request, #3671:
URL: https://github.com/apache/dubbo-go/pull/3671

   ### Description
   Fixes #3670
   
   The single-protocol `Server.Run` paths returned `http.ErrServerClosed` 
verbatim after a normal `Stop`, so every clean shutdown surfaced the net/http 
normal-closure signal to the caller. The outer `startTransport` goroutine logs 
any non-nil error as `server serve failed`, so each shutdown produced a 
spurious error log; the dual-protocol path already swallowed the signal inside 
its errgroup, so single- and dual-protocol shutdown behaviour diverged.
   
   Align the single-protocol paths with the dual-protocol one: filter 
`http.ErrServerClosed` in `startHttp2` / `startHttp3` before returning. Only 
the normal-closure signal is suppressed; genuine serve errors (e.g. 
`EADDRINUSE`) still propagate.
   
   ### Changes
   
   - `triple_protocol/server.go` — filter `http.ErrServerClosed` in 
`startHttp2` / `startHttp3` before returning, matching the dual-protocol 
behaviour
   - `triple_protocol/server_lifecycle_test.go` — switch the six 
`require.ErrorIs(..., http.ErrServerClosed)` assertions to `require.NoError`; 
fold the now-uniform `if/else` in `TestServer_RepeatedStartStop` into a single 
assertion; drop the stale comments that described only the dual-protocol 
swallowing behaviour
   
   ### Test
   
   Add 2 tests guarding the boundary of the filter:
   
   | Test | Description |
   | --- | --- |
   | `TestServerRunReturnsBindErrorWhenPortInUse` | Occupies the TCP port 
before `Run`, asserting that a genuine serve error (`EADDRINUSE`) is still 
propagated instead of being swallowed together with `http.ErrServerClosed` |
   | `TestServerRunHTTP3ReturnsBindErrorWhenPortInUse` | Same boundary check on 
the HTTP/3 path: the QUIC endpoint fails to bind the occupied UDP port and 
`Run` still returns the error |
   
   ### Validation
   
   - Before the fix, a normal `Stop` made `Run` return `http.ErrServerClosed` 
and the outer goroutine logged a spurious `server serve failed` error; after 
the fix `Run` returns `nil` and no error is logged
   - The updated lifecycle tests fail on the pre-fix code and pass with the 
filter
   
   ### Checklist
   - [x] I confirm the target branch is `develop`
   - [x] I have run `make fmt` to format my code
   - [x] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


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