Skip to content

Conversation

@pgomulka
Copy link
Contributor

Slow loggers should use single shared logger as otherwise when index is
deleted the log4j logger will remain reachable (log4j is caching) and
will create a memory leak.

closes #56171

Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak.
@pgomulka pgomulka added :Core/Infra/Logging Log management and logging utilities Team:Core/Infra Meta label for core/infra team v7.9.0 labels May 13, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Logging)

@pgomulka pgomulka marked this pull request as ready for review May 14, 2020 12:48
@pgomulka pgomulka requested review from jasontedor and rjernst May 14, 2020 12:48
@pgomulka
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/1

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

I left one comment relating the representation of specificity. Also, I think we should have a test that the memory leak is no longer present? That is creating N indices doesn't result in N slow loggers?

Otherwise, this is looking great.

private long indexInfoThreshold;
private long indexDebugThreshold;
private long indexTraceThreshold;
/**
Copy link
Member

Choose a reason for hiding this comment

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

A nit here, sorry: I know this is carried over from the code that you moved, but this is labeled as a Javadoc /** on a private field. It should be a regular comment /*. Also no reason to not make this comment use the full 140 columns that are available. 😇

WARN(3), //most specific - little logging
INFO(2),
DEBUG(1),
TRACE(0); //least specific - lots of logging
Copy link
Member

Choose a reason for hiding this comment

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

Nit: space between the // and the start of the comment

IndexingSlowLog log2 = new IndexingSlowLog(index2Settings);
context = (LoggerContext) LogManager.getContext(false);

int numberOfLoggersAfter = context.getLoggers().size();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can do this a random number of times, in a loop, say up to 64 or something like that, just to really exercise that no new ones are created?

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM. I left a few comments. No need for another review round though.

@pgomulka pgomulka merged commit 0e34b2f into elastic:7.x May 27, 2020
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes elastic#56171
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes elastic#56171
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes elastic#56171
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes elastic#56171
pgomulka added a commit that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes #56171
pgomulka added a commit that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes #56171
pgomulka added a commit that referenced this pull request May 27, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes #56171
pgomulka added a commit that referenced this pull request May 28, 2020
Slow loggers should use single shared logger as otherwise when index is deleted the log4j logger will remain reachable (log4j is caching) and will create a memory leak. closes #56171
@williamrandolph
Copy link
Contributor

I'm removing the Backport Pending label since this appears to merged into all the labeled branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants