Skip to content

Conversation

ash2k
Copy link
Member

@ash2k ash2k commented Aug 27, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

See the discussion at #329 (comment).

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 27, 2025
@k8s-ci-robot k8s-ci-robot requested review from deads2k and dims August 27, 2025 01:40
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ash2k
Once this PR has been reviewed and has the lgtm label, please assign deads2k for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 27, 2025
}
}
})
return nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it doesn't make sense to return an error for double close. Either we return the actual underlying errors or no error at all. Any reason to create "artificial" errors? I.e. nothing bad happened because of the second call, why return an error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative implementation here would still synchronize the shutdown of goroutines, but call Close on listeners as many times as this Close is called and then return the real errors, if any. I.e. pass the duplicate call through.

for connErr := range ml.connCh {
if connErr.conn != nil {
_ = connErr.conn.Close()
}
Copy link
Member Author

@ash2k ash2k Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why this loop is necessary. Channel is not buffered and we've told the publishing goroutines to stop just above via close(ml.stopCh) - they will each close the connection they are trying to push, if any.

@ash2k ash2k mentioned this pull request Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants