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

Cherry-pick #19459 to 7.8: [Filebeat] Fix reference leak in TCP and Unix socket inputs #19502

Merged
merged 3 commits into from
Jul 16, 2020

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Jun 29, 2020

Cherry-pick of PR #19459 to 7.8 branch. Original message:

What does this PR do?

The tcp and unix input sources were leaking references causing a memory leak.
When an accepted connection ended inputsource/common.Closer was
supposed to delete the pointer that it held to the connection, but due to a code
error delete was being called on the wrong map.

Why is it important?

This fixes a memory leak with the tcp and unix inputs.

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.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@andrewkroh andrewkroh added [zube]: In Review backport Team:Services (Deprecated) Label for the former Integrations-Services team labels Jun 29, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 29, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 29, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 29, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [andrewkroh commented: run tests]

  • Start Time: 2020-07-16T17:26:10.822+0000

  • Duration: 75 min 49 sec

Test stats 🧪

Test Results
Failed 0
Passed 9288
Skipped 1586
Total 10874

Steps errors

Expand to view the steps failures

  • Name: Report to Codecov

    • Description: curl -sSLo codecov https://codecov.io/bash for i in auditbeat filebeat heartbeat libbeat metricbeat packetbeat winlogbeat journalbeat do FILE="${i}/build/coverage/full.cov" if [ -f "${FILE}" ]; then bash codecov -f "${FILE}" fi done

    • Duration: 2 min 22 sec

    • Start Time: 2020-07-16T18:11:20.605+0000

    • log

  • Name: Make -C generator/_templates/beat test

    • Description: make -C generator/_templates/beat test

    • Duration: 1 min 22 sec

    • Start Time: 2020-07-16T18:32:58.217+0000

    • log

@andrewkroh andrewkroh requested a review from urso July 6, 2020 13:20
@urso
Copy link

urso commented Jul 7, 2020

something went wrong in the backport.

…19459)

The tcp and unix input sources were leaking references causing a memory leak.
When an accepted connection ended inputsource/common.Closer was
supposed to delete the pointer that it held to the connection, but due to a code
error `delete` was being called on the wrong map.

Instead of modifying the common.Closer I replaced it with a cancellable context.Context which
is designed to propagate signals from parent to children and requires less code.

(cherry picked from commit 61f4846)
@andrewkroh andrewkroh force-pushed the backport_19459_7.8 branch from 14f4102 to 5e94d42 Compare July 13, 2020 13:26
@andrewkroh
Copy link
Member Author

run tests

@andrewkroh
Copy link
Member Author

run tests

@andrewkroh andrewkroh merged commit 66293c5 into elastic:7.8 Jul 16, 2020
@zube zube bot removed the [zube]: Done label Oct 15, 2020
@andrewkroh andrewkroh deleted the backport_19459_7.8 branch January 14, 2022 14:04
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…P and Unix socket inputs (elastic#19502)

* [Filebeat] Fix reference leak in TCP and Unix socket inputs (elastic#19459)

The tcp and unix input sources were leaking references causing a memory leak.
When an accepted connection ended inputsource/common.Closer was
supposed to delete the pointer that it held to the connection, but due to a code
error `delete` was being called on the wrong map.

Instead of modifying the common.Closer I replaced it with a cancellable context.Context which
is designed to propagate signals from parent to children and requires less code.

(cherry picked from commit 8eb8ed7)

* Update vendor and notice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Services (Deprecated) Label for the former Integrations-Services team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants