hyperledger/fabric-sdk-go

Too many open files error with go sdk user register and enroll

kamalp2e opened this issue · 0 comments

While using go sdk User registration and user enroll it is found that connection established to ca node is not getting closed.
In below mentioned file on line number 473 inside defer function "err := resp.Body.Close()" body is getting closed but not the connection established with CA.
https://github.com/hyperledger/fabric-sdk-go/blob/main/internal/github.com/hyperledger/fabric-ca/lib/client.go

Solution to close the session is to modify the defer function as

defer func() {
err := resp.Body.Close()
c.httpClient.CloseIdleConnections() //Add this new Line to close connection
if err != nil {
log.Debugf("Failed to close the response body: %s", err.Error())
}
}()

connectionNotClosingPostRegistrationEnroll