grafeas / voucher

🎟 Voucher creates attestations for Binary Authorization
Apache License 2.0
73 stars 24 forks source link

containeranalysis: close grpcClient #50

Closed thepwagner closed 2 years ago

thepwagner commented 2 years ago

In containeranalysis.NewClient(), we allocate a containeranalysis client, but only use the .GetGrafeasClient() member.

This results in leaking the containeranalysis client's connection pool, whenever a new client is created.

Longer term, we should look at reusing connections as an alternative solution to this leak: there are other performance advantages.

Co-Authored-By: Brian Chen brian.chen@shopify.com Co-Authored-By: Aline Shulzhenko lynnsh@users.noreply.github.com

Related

thepwagner commented 2 years ago

_lynnsh noted from https://pkg.go.dev/cloud.google.com/go/containeranalysis/apiv1#Client.GetGrafeasClient

Calling Close on either the grafeas or containeranalysis client will close the shared connection in both.

I think that comment is out of date, opened https://github.com/googleapis/google-cloud-go/issues/5217 to confirm or deny this.

thepwagner commented 2 years ago

This is behaving great in our test environment, :shipit: and closing #20