Skip to content

Commit

Permalink
fix(datconn): don't orphan client goroutine when remote is closed
Browse files Browse the repository at this point in the history
Longhorn 8711

Signed-off-by: Eric Weber <eric.weber@suse.com>
  • Loading branch information
ejweber authored and PhanLe1010 committed Aug 26, 2024
1 parent fd3a0c4 commit 7176d3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/backend/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ type Remote struct {

func (r *Remote) Close() error {
logrus.Infof("Closing: %s", r.name)

// Close the dataconn client to avoid orphaning goroutines.
if dataconnClient, ok := r.ReaderWriterUnmapperAt.(*dataconn.Client); ok {
dataconnClient.Close()
}

conn, err := grpc.NewClient(r.replicaServiceURL, grpc.WithTransportCredentials(insecure.NewCredentials()),
ptypes.WithIdentityValidationClientInterceptor(r.volumeName, ""))
if err != nil {
Expand Down

0 comments on commit 7176d3a

Please sign in to comment.