hyperledger / fabric-sdk-go

https://wiki.hyperledger.org/display/fabric
Apache License 2.0
910 stars 510 forks source link

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

Open kamalp2e opened 7 months ago

kamalp2e commented 7 months ago

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