-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
SlowLoggers using single logger #56708
Conversation
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.
Pinging @elastic/es-core-infra (:Core/Infra/Logging) |
@elasticmachine run elasticsearch-ci/1 |
server/src/main/java/org/elasticsearch/index/IndexingSlowLog.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/common/logging/MockAppender.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/common/logging/MockAppender.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/index/SlowLogLevelTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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; | ||
/** |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
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
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
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
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
I'm removing the Backport Pending label since this appears to merged into all the labeled branches. |
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