Skip to content

fix(fxconfig): defer CloseSend on broadcast stream to prevent connection leak (#209)#216

Open
SAY-5 wants to merge 1 commit into
hyperledger:mainfrom
SAY-5:fix/issue-209-orderer-stream-leak
Open

fix(fxconfig): defer CloseSend on broadcast stream to prevent connection leak (#209)#216
SAY-5 wants to merge 1 commit into
hyperledger:mainfrom
SAY-5:fix/issue-209-orderer-stream-leak

Conversation

@SAY-5

@SAY-5 SAY-5 commented Apr 30, 2026

Copy link
Copy Markdown

Fixes #209. OrdererClient.send() opens a gRPC broadcast stream via oc.client.Broadcast(ctx) but never calls CloseSend(). On every error path (Send failure, Recv failure, non-SUCCESS status) and even on the success path, the stream is abandoned. The underlying gRPC connection is held until ctx cancellation rather than released immediately, leaking one stream per call.

Change

tools/fxconfig/internal/client/orderer.go:82, add defer abc.CloseSend() immediately after the stream is successfully opened. CloseSend only signals end-of-send to the server; it doesn't tear down the connection or affect the in-flight Recv, so all four exit paths now release the stream cleanly.

Test plan

  • go build ./tools/fxconfig/..., clean
  • go vet ./tools/fxconfig/..., clean
  • No behaviour change beyond the cleanup; Recv still runs after Send and returns the same status before defer fires

…ion leak (hyperledger#209)

Signed-off-by: SAY-5 <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gRPC broadcast stream never closed in OrdererClient.send() causing connection leak

1 participant