Skip to content

HDDS-7349. Flaky integration test have memory leak for RatisDropwizardExports#3858

Merged
adoroszlai merged 2 commits intoapache:masterfrom
sumitagrawl:HDDS-7349
Oct 26, 2022
Merged

HDDS-7349. Flaky integration test have memory leak for RatisDropwizardExports#3858
adoroszlai merged 2 commits intoapache:masterfrom
sumitagrawl:HDDS-7349

Conversation

@sumitagrawl
Copy link
Contributor

What changes were proposed in this pull request?

  1. Additional RatisDropwizardExports old by DNs after its closed
  2. register of RatisDropwizardExports even its already present with name in ratisMetricsMap

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-7349

How was this patch tested?

Tested with flaky and taking heapdump for objects of RatisDropwizardExports referred by DNs ratisMetricsMap.

@sumitagrawl
Copy link
Contributor Author

@nandakumar131 @ChenSammi Please review

@sumitagrawl
Copy link
Contributor Author

@szetszwo plz review

@szetszwo
Copy link
Contributor

@sumitagrawl , each datanode/om/scm creates its own MetricRegistries instead using global(); see https://issues.apache.org/jira/secure/attachment/13051264/MetricRegistries.patch

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

@sumitagrawl , the change looks good. Some comments inlined; see also https://issues.apache.org/jira/secure/attachment/13051276/3858_review.patch

public static void registerRatisMetricReporters(
Map<String, RatisDropwizardExports> ratisMetricsMap) {
Map<String, RatisDropwizardExports> ratisMetricsMap,
AtomicBoolean isStopped) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use BooleanSupplier.

private static void registerDropwizard(RatisMetricRegistry registry,
Map<String, RatisDropwizardExports> ratisMetricsMap) {
Map<String, RatisDropwizardExports> ratisMetricsMap,
AtomicBoolean isStopped) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use BooleanSupplier.

RatisDropwizardExports rde = new RatisDropwizardExports(
registry.getDropWizardMetricRegistry());
CollectorRegistry.defaultRegistry.register(rde);
String name = registry.getMetricRegistryInfo().getName();
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep name declared after rde, i.e.

     RatisDropwizardExports rde = new RatisDropwizardExports(
         registry.getDropWizardMetricRegistry());
     String name = registry.getMetricRegistryInfo().getName();

private static final int MSECS_PER_MINUTE = 60 * 1000;

private final boolean isSecurityEnabled;
private final AtomicBoolean isStopped = new AtomicBoolean(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use omState and do not add isStopped.

// This needs to be done before initializing Ratis.
RatisDropwizardExports.
registerRatisMetricReporters(ratisMetricsMap);
registerRatisMetricReporters(ratisMetricsMap, isStopped);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use () -> omState == State.STOPPED.

@sumitagrawl sumitagrawl requested a review from szetszwo October 26, 2022 11:47
Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good.

@szetszwo
Copy link
Contributor

...; see also https://issues.apache.org/jira/secure/attachment/13051276/3858_review.patch

@sumitagrawl , just found that I uploaded a wrong file. It was great that you have fixed everything already! Anyway, this is the correct file https://issues.apache.org/jira/secure/attachment/13051439/3858_review2.patch

@adoroszlai adoroszlai merged commit b5ecea6 into apache:master Oct 26, 2022
@adoroszlai
Copy link
Contributor

Thanks @sumitagrawl for the patch, @szetszwo for the review.

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.

3 participants