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 potential fd leakage for SegmentProcessorFramework #9797

Merged
merged 1 commit into from
Nov 18, 2022

Conversation

klsince
Copy link
Contributor

@klsince klsince commented Nov 14, 2022

Try to fix #9415: potential fd leakage in SegmentProcessorFramework. The fileManager has to call cleanup to release the mmap'ed intermediate files.

@codecov-commenter
Copy link

Codecov Report

Merging #9797 (291b5c1) into master (dc49b2c) will decrease coverage by 38.81%.
The diff coverage is 100.00%.

@@              Coverage Diff              @@
##             master    #9797       +/-   ##
=============================================
- Coverage     64.08%   25.27%   -38.82%     
+ Complexity     4970       44     -4926     
=============================================
  Files          1903     1944       +41     
  Lines        102553   104622     +2069     
  Branches      15605    15854      +249     
=============================================
- Hits          65722    26441    -39281     
- Misses        32062    75472    +43410     
+ Partials       4769     2709     -2060     
Flag Coverage Δ
integration1 25.27% <100.00%> (?)
unittests1 ?
unittests2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rocessing/framework/SegmentProcessorFramework.java 90.78% <100.00%> (-7.90%) ⬇️
...in/java/org/apache/pinot/spi/utils/BytesUtils.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/BaseRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/NoOpRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/config/table/FSTType.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/config/user/RoleType.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/data/MetricFieldSpec.java 0.00% <0.00%> (-100.00%) ⬇️
...ava/org/apache/pinot/spi/stream/StreamMessage.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/common/tier/TierFactory.java 0.00% <0.00%> (-100.00%) ⬇️
...a/org/apache/pinot/spi/config/table/TableType.java 0.00% <0.00%> (-100.00%) ⬇️
... and 1571 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

outputSegmentDirs.add(driver.getOutputDirectory());
}
} finally {
fileManager.cleanUp();
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like we can assert _mapperOutputDir is cleaned in SegmentProcessorFramework before calling FileUtils.cleanDirectory(workingDir);?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_mapperOutputDir and _reducerOutputDir are internal to this framework, so the caller can't check their existence. And when the issue happened, the files were deleted (file names were gone from the file system). But as it's still opened by the process via mmap, so the file (inode, disk space) was not released cleanly.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 ok

Copy link
Contributor

@walterddr walterddr left a comment

Choose a reason for hiding this comment

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

lgtm. one comment on adding tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minion Keeping segments on disk after RealtimeToOfflineSegmentsTask
3 participants