wang-jiahua opened a new pull request, #1359:
URL: https://github.com/apache/rocketmq-clients/pull/1359

   ### Which Issue(s) This PR Fixes
   
   Fixes #1358
   
   ### Brief Description
   
   `go vet` reports 13 `lostcancel` findings in the golang client: the 11 unary 
RPC wrappers in `client_manager.go`, the dial timeout in `conn.go`, and 
`Telemetry` all discard the cancel function returned by `context.WithTimeout`.
   
   - For the 11 unary RPCs and the dial path this PR switches to `ctx, cancel 
:= context.WithTimeout(...)` + `defer cancel()`, releasing the timer as soon as 
the call returns instead of waiting for the deadline to expire.
   - `Telemetry` is different: it returns a long-lived bidirectional stream 
cached in `clientSettings.observer`, so a per-call timeout is not a leak but a 
behavior bug — the deadline kills the cached stream every `timeout` interval 
and forces the recv loop to rebuild it. The timeout is removed and the 
caller-provided context is used directly, matching how the other streaming RPC 
(`ReceiveMessage`) handles its context; the `duration` parameter is kept for 
interface compatibility.
   
   ### How Did You Test This Change?
   
   - `go vet ./...`: lostcancel findings 13 → 0.
   - `go build ./...` passes; `go test ./...` passes with no regressions 
(including the client recovery tests); `gofmt -l` clean.
   - Branch rebased onto current master (includes #1305, which touched 
`client_manager.go` for close-path cleanup but did not address the 
`WithTimeout` call sites).
   


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

Reply via email to