logd: fix memory leak due to slow reader

Kernel panic - not syncing: Out of memory occurred once after 8 hours
automatic test which cases are about Summary:logd memory leak UTResult
: 1/1

IssueID: 93440

Rootcause: the method "LogTimeEntry::FilterSecondPass"(called inside
"LogBuffer::flushTo") does not check the condition flag
"LogTimeEntry::mRelease" which will be set to true when "logd" begins
to kick off a client when it finding the client is slow-est.
Therefore the client cannot be kicked off and hence the log-element
list becomes longer and longer if the slowest client reading more
slower than the writer writing.

Change-Id: I91a44a393e63b3122c15ce269ee195e0eb4339e8
Solution: add the check.
Test: logd kills slow reader
This commit is contained in:
Jintao_Zhu 2018-11-11 03:13:24 -08:00 committed by Tom Cherry
parent 13856a05e7
commit 5f93072db3

View file

@ -204,6 +204,10 @@ int LogTimeEntry::FilterSecondPass(const LogBufferElement* element, void* obj) {
goto skip;
}
if (me->mRelease) {
goto stop;
}
if (!me->mTail) {
goto ok;
}