Skip to content

Cherry-pick #21048 to 7.x: Filebeat: Fix random error on harvester close#21055

Merged
adriansr merged 1 commit intoelastic:7.xfrom
adriansr:backport_21048_7.x
Sep 14, 2020
Merged

Cherry-pick #21048 to 7.x: Filebeat: Fix random error on harvester close#21055
adriansr merged 1 commit intoelastic:7.xfrom
adriansr:backport_21048_7.x

Conversation

@adriansr
Copy link
Copy Markdown
Contributor

@adriansr adriansr commented Sep 10, 2020

Cherry-pick of PR #21048 to 7.x branch. Original message:

This fixes a race condition when a harvester is closed at the same time that its source file size is being calculated.

Why is it important?

Random Error updating file size errors have been reported. Other than that it looks like the bug has no other effect.

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.

Author's Checklist

  • Make sure the new synchronization is safe

How to test this PR locally

It's easy to trigger this error by removing the Ticker in monitorFileSize and busy loop calling h.updateCurrentSize(), with a configuration that uses close_eof and many files.

Logs

Error updating file size: GetFileInformationByHandleEx [...path...]: The handle is invalid.; File: [...path...]

This fixes a race condition when a harvester is closed at the same time
that its source file size is being calculated.

Before this fix, `Error updating file size` errors are randomly printed, because
the file handle becomes closed inside the os.Stat call.

(cherry picked from commit af6222d)
@adriansr adriansr added [zube]: In Review backport Team:Services (Deprecated) Label for the former Integrations-Services team Team:SIEM labels Sep 10, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/siem (Team:SIEM)

@elasticmachine
Copy link
Copy Markdown
Contributor

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

@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 Sep 10, 2020
@adriansr adriansr requested a review from kvch September 10, 2020 14:40
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #21055 opened]

  • Start Time: 2020-09-10T14:39:04.004+0000

  • Duration: 56 min 42 sec

Test stats 🧪

Test Results
Failed 0
Passed 5558
Skipped 833
Total 6391

@adriansr adriansr merged commit 4545a06 into elastic:7.x Sep 14, 2020
@zube zube bot removed the [zube]: Done label Dec 14, 2020
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.

3 participants