Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid drainErrChan hanging forever if the channel is closed #4314

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

AndersonQ
Copy link
Member

What does this PR do?

Makes drainErrChan to return if the channel is closed.
As it's possible to read from a closed channel, if the channel passed to drainErrChan is closed it'd never exit.

Why is it important?

drainErrChan would never return if received a closed channel and therefore would hang the test until it times out.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

How to test this PR locally

check the behaviour here: https://go.dev/play/p/WVM-P8RwJaM

Related issues

  • N/A

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@AndersonQ AndersonQ added Team:Elastic-Agent Label for the Agent team skip-changelog backport-v8.12.0 Automated backport with mergify backport-v8.13.0 Automated backport with mergify labels Feb 22, 2024
@AndersonQ AndersonQ self-assigned this Feb 22, 2024
@AndersonQ AndersonQ requested a review from a team as a code owner February 22, 2024 12:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@AndersonQ AndersonQ enabled auto-merge (squash) February 22, 2024 13:51
@AndersonQ AndersonQ changed the title Avoid drainErrChan hanging forever if the channel is closed. Avoid drainErrChan hanging forever if the channel is closed Feb 22, 2024
@AndersonQ AndersonQ merged commit 00550ca into elastic:main Feb 22, 2024
13 checks passed
mergify bot pushed a commit that referenced this pull request Feb 22, 2024
mergify bot pushed a commit that referenced this pull request Feb 22, 2024
AndersonQ added a commit that referenced this pull request Feb 22, 2024
(cherry picked from commit 00550ca)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
AndersonQ added a commit that referenced this pull request Feb 23, 2024
(cherry picked from commit 00550ca)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.12.0 Automated backport with mergify backport-v8.13.0 Automated backport with mergify skip-changelog Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants