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

Fix file handle leak when handling errors in filestream #37973

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

rdner
Copy link
Member

@rdner rdner commented Feb 12, 2024

Files were not closed properly in some rare error cases.

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.

How to test this PR locally

The existing tests should make sure that the existing functionality is not broken.

Related issues

Files were not closed properly in some rare error cases.
@rdner rdner added bug Filebeat Filebeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-v8.12.0 Automated backport with mergify labels Feb 12, 2024
@rdner rdner self-assigned this Feb 12, 2024
@rdner rdner requested a review from a team as a code owner February 12, 2024 12:09
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Feb 12, 2024
@rdner rdner mentioned this pull request Feb 12, 2024
6 tasks
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 12, 2024

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Duration: 132 min 10 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@belimawr belimawr left a comment

Choose a reason for hiding this comment

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

There is still a f.Close() left in openFile that could lead to double closing the file in case of an error.

It's here:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @rdner

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @rdner

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @rdner

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @rdner

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @rdner

@rdner rdner requested a review from belimawr February 12, 2024 16:58
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 12, 2024

💔 Build Failed

Failed CI Steps

History

cc @rdner

@rdner rdner merged commit f7e5b4c into elastic:main Feb 13, 2024
52 of 54 checks passed
@rdner rdner deleted the fix-file-handle-leak-filestream branch February 13, 2024 08:27
mergify bot pushed a commit that referenced this pull request Feb 13, 2024
Files were not closed properly in some rare error cases.

(cherry picked from commit f7e5b4c)

# Conflicts:
#	filebeat/input/filestream/input.go
rdner added a commit that referenced this pull request Feb 13, 2024
…filestream (#37995)

* Fix file handle leak when handling errors in filestream (#37973)

Files were not closed properly in some rare error cases.

(cherry picked from commit f7e5b4c)

# Conflicts:
#	filebeat/input/filestream/input.go

---------

Co-authored-by: Denis <[email protected]>
@rdner rdner added the backport-7.17 Automated backport to the 7.17 branch with mergify label Feb 14, 2024
mergify bot pushed a commit that referenced this pull request Feb 14, 2024
Files were not closed properly in some rare error cases.

(cherry picked from commit f7e5b4c)

# Conflicts:
#	filebeat/input/filestream/input.go
rdner added a commit that referenced this pull request Feb 14, 2024
…filestream (#38013)

* Fix file handle leak when handling errors in filestream (#37973)

Files were not closed properly in some rare error cases.

(cherry picked from commit f7e5b4c)

# Conflicts:
#	filebeat/input/filestream/input.go

---------

Co-authored-by: Denis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.12.0 Automated backport with mergify bug Filebeat Filebeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants