RPC Binder: increase transaction size
One of the RPC Binder usecases requires a larger transaction limit. This
change increases the limit, and it unifies the 'too large transaction'
logging from regular and RPC binder. This hopefully makes it more clear
why there is a limit there, we want to keep code compatible between the
two transports.
A test is added to show the current behavior. When a transaction which
is sent is too large, the server closes the session. This is probably
the correct behavior for too large replies, but for too large
transactions, the client could handle these errors.
b/392717039 is filed to investigate inconsistencies raised in the test
more deeply.
Fixes: 392575419
Test: atest binderRpcTest --test-filter="*LargeVector*"
Change-Id: I2eeb08818c10371c7f77a35abee7d4e46bb63d72
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
index 444f061..c13e0f9 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -28,6 +28,7 @@
#include <stdio.h>
#include "BuildFlags.h"
+#include "Constants.h"
#include "file.h"
//#undef ALOGV
@@ -63,9 +64,6 @@
static constexpr uint32_t kBinderProxyCountWarnInterval = 5000;
-// Log any transactions for which the data exceeds this size
-#define LOG_TRANSACTIONS_OVER_SIZE (300 * 1024)
-
enum {
LIMIT_REACHED_MASK = 0x80000000, // A flag denoting that the limit has been reached
WARNING_REACHED_MASK = 0x40000000, // A flag denoting that the warning has been reached
@@ -403,9 +401,11 @@
status = IPCThreadState::self()->transact(binderHandle(), code, data, reply, flags);
}
- if (data.dataSize() > LOG_TRANSACTIONS_OVER_SIZE) {
+
+ if (data.dataSize() > binder::kLogTransactionsOverBytes) {
RpcMutexUniqueLock _l(mLock);
- ALOGW("Large outgoing transaction of %zu bytes, interface descriptor %s, code %d",
+ ALOGW("Large outgoing transaction of %zu bytes, interface descriptor %s, code %d was "
+ "sent",
data.dataSize(), String8(mDescriptorCache).c_str(), code);
}