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: fixed file leak in listing directory ServicesMain #16825

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

alex-kuzmin-hg
Copy link

Description:

Related issue(s):
#16083
Fixes #16083

Notes for reviewer:

Checklist

Before fix:
without fix:
[root@network-node0-0 hgcapp]# ls -l /proc/89/fd | grep ServicesMain | wc -l
136

with fix:
[root@network-node0-0 hgcapp]# ls -l /proc/138/fd | grep ServicesMain | wc -l
0

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@alex-kuzmin-hg alex-kuzmin-hg requested a review from a team as a code owner November 27, 2024 18:17
@alex-kuzmin-hg alex-kuzmin-hg changed the title Fixed 16083. Verified on multi-node cluster for max TPS and Reconnect fix: fixed file leak in listing directory ServicesMain Nov 27, 2024
@alex-kuzmin-hg alex-kuzmin-hg self-assigned this Nov 27, 2024
@alex-kuzmin-hg alex-kuzmin-hg added this to the v0.58 milestone Nov 27, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 42.30769% with 15 lines in your changes missing coverage. Please review.

Project coverage is 63.62%. Comparing base (32089ae) to head (f2f0d01).

Files with missing lines Patch % Lines
...s/platform/state/snapshot/SignedStateFilePath.java 42.30% 14 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #16825      +/-   ##
=============================================
- Coverage      63.62%   63.62%   -0.01%     
+ Complexity     20401    20400       -1     
=============================================
  Files           2537     2537              
  Lines          94757    94758       +1     
  Branches        9904     9904              
=============================================
  Hits           60288    60288              
  Misses         30863    30863              
- Partials        3606     3607       +1     
Files with missing lines Coverage Δ
...s/platform/state/snapshot/SignedStateFilePath.java 58.13% <42.30%> (+0.99%) ⬆️

... and 10 files with indirect coverage changes

Impacted file tree graph

Copy link

codacy-production bot commented Nov 27, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) 46.15%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (32089ae) 97522 63704 65.32%
Head commit (f2f0d01) 97523 (+1) 63705 (+1) 65.32% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#16825) 26 12 46.15%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@alex-kuzmin-hg
Copy link
Author

Retyped description:
Fixed file leak in Files.list() of /data/saved/*ServicesMain that
was leaking from 50 to 100 file descriptors per hour under heavy load NFT test.

Tested:
10-node Latitude 2hrs NTF test , with and without Reconnect
7-node HashSphere 2hrs NTF test
7-node HashSphere 16-hrs NTF test with limited TPS=700

No performance degradation detected.

subDir.toAbsolutePath());
continue;
}
final List<Path> dirs = list.filter(Files::isDirectory).toList();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use list.forEach()?

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.

File leak: data/saved/com.hedera.services.ServicesMain
2 participants