hyperledger / hyperledger/fabric-x
fxconfig: prevent reuse of closed orderer and notification clients across submissions
- Dominant language
- Go
- Stars
- 64
- Forks
- 80
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 15
Description
Title: fxconfig: prevent reuse of closed orderer and notification clients across submissions
Problem
`fxconfig` uses `provider.Provider.Get()` to lazily initialize and cache service instances with `sync.Once`.
However, the submission path closes some of the returned clients after use:
- the orderer client is closed at the end of submission
- the notification client is also closed in the `--wait` flow
This creates an ownership mismatch:
- providers cache these clients as long-lived instances
- callers treat them as per-operation resources
As a result, repeated operations may reuse a cached client whose underlying connection has already been closed.
Code path
- `tools/fxconfig/internal/provider/provider.go`: `Provider.Get()` memoizes instances using `sync.Once`
- `tools/fxconfig/internal/app/submit.go`: submission closes the orderer client after use
- `tools/fxconfig/internal/app/submit.go`: `SubmitTransactionWithWait` also closes the notification client
Why it matters
This may cause repeated CLI operations in the same application instance to fail unpredictably and makes client lifecycle semantics unclear.
Suggested direction
Choose one ownership model and apply it consistently:
1. Providers should not cache closeable gRPC clients and should create fresh instances per use, or
2. Providers should own the lifecycle of cached clients, and consumers should not close provider-managed instances.
Acceptance criteria
- repeated submit operations work correctly
- repeated submit-with-wait operations work correctly
- client ownership semantics are clear in code
- regression tests cover repeated usage
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.