summaryrefslogtreecommitdiffstats
path: root/logd/LogReader.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-02-23 08:55:43 -0800
committerMark Salyzyn <salyzyn@google.com>2016-02-24 10:15:32 -0800
commit5c77ad55d0cdee84cd45fd5d0d066f3c61d76ce6 (patch)
tree216177a8529acb85d06a4f2c86f9f5d28aedc7c5 /logd/LogReader.cpp
parent2ad0bd0a9b594bbe2560b405b0008b7bc742cfca (diff)
downloadsystem_core-5c77ad55d0cdee84cd45fd5d0d066f3c61d76ce6.tar.gz
system_core-5c77ad55d0cdee84cd45fd5d0d066f3c61d76ce6.tar.bz2
system_core-5c77ad55d0cdee84cd45fd5d0d066f3c61d76ce6.zip
logd: sock_alloc_send_pskb starves pruning
Allow socket send syscall to terminate after 32 seconds if reader stalled because of memory pressure allocating new network buffers Add a gTest to catch regressions, add security buffer to log_dump Bug: 27242723 Change-Id: Idaa6699d9d284e7f5f723ae0e76b3d6aa3371489
Diffstat (limited to 'logd/LogReader.cpp')
-rw-r--r--logd/LogReader.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index 16362379c..2c07984ce 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -18,6 +18,7 @@
#include <poll.h>
#include <sys/prctl.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <cutils/sockets.h>
@@ -179,6 +180,11 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
}
FlushCommand command(*this, nonBlock, tail, logMask, pid, sequence, timeout);
+
+ // Set acceptable upper limit to wait for slow reader processing b/27242723
+ struct timeval t = { LOGD_SNDTIMEO, 0 };
+ setsockopt(cli->getSocket(), SOL_SOCKET, SO_SNDTIMEO, (const char *)&t, sizeof(t));
+
command.runSocketCommand(cli);
return true;
}