From 2330e9be157fdfa04d3b3fdb17a2d54233a93cd3 Mon Sep 17 00:00:00 2001 From: Tej Singh Date: Fri, 29 May 2020 15:13:23 -0700 Subject: [PATCH] Retry pullfinish with empty payload if call fails If the first call for pullFinished fails, it is likely because the transaction is too large. Currently, if this happens statsd will just sleep until the timeout. With this change, the client will retry calling pullFinish if the first attempt fails, but with an empty payload (and with success = false) to cause the puller to fail fast, and so statsd does not wait for the timeout. Test: atest GtsStatsdHostTestCases Bug: 157768117 Change-Id: I1af29b6c83039ab56ef847832a600d4afea34000 --- .../framework/java/android/app/StatsManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apex/statsd/framework/java/android/app/StatsManager.java b/apex/statsd/framework/java/android/app/StatsManager.java index d1b7d8dc2c7ae..436102a3ec76f 100644 --- a/apex/statsd/framework/java/android/app/StatsManager.java +++ b/apex/statsd/framework/java/android/app/StatsManager.java @@ -561,7 +561,15 @@ public final class StatsManager { try { resultReceiver.pullFinished(atomTag, success, parcels); } catch (RemoteException e) { - Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId); + Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId + + " due to TransactionTooLarge. Calling pullFinish with no data"); + StatsEventParcel[] emptyData = new StatsEventParcel[0]; + try { + resultReceiver.pullFinished(atomTag, /*success=*/false, emptyData); + } catch (RemoteException nestedException) { + Log.w(TAG, "StatsPullResultReceiver failed for tag " + mAtomId + + " with empty payload"); + } } }); } finally {