From d244bd097c096a8da1a6751145aff02b87987ec3 Mon Sep 17 00:00:00 2001 From: "h.zhang" Date: Sun, 14 Jun 2020 14:46:54 +0800 Subject: [PATCH] Memory leak due to no stop for IpNeighborMonitor. 1. When Wi-Fi enabled, ap0 interface is added and IpNeighborMonitor's start() is invoked in IpServer's constructor. 2. There's no stop for IpNeighborMonitor when IpServer stop. 3. During overnight test for Wi-Fi, networkstack is too slow to process request due to memory leak in IpNeighborMonitor and binder buffer is blocked causing exception. Solution: Invoke IpNeighborMonitor.stop() in UnavailableState.enter(). Bug: 159097215 Test: automatic, turn on and off Wi-Fi every 6 seconds overnight Change-Id: I8f60c13706f05306e8f25a15f7861d7ecabbc10e --- Tethering/src/android/net/ip/IpServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Tethering/src/android/net/ip/IpServer.java b/Tethering/src/android/net/ip/IpServer.java index 1671dda4bd..2871e7f682 100644 --- a/Tethering/src/android/net/ip/IpServer.java +++ b/Tethering/src/android/net/ip/IpServer.java @@ -1321,6 +1321,7 @@ public class IpServer extends StateMachine { class UnavailableState extends State { @Override public void enter() { + mIpNeighborMonitor.stop(); mLastError = TetheringManager.TETHER_ERROR_NO_ERROR; sendInterfaceState(STATE_UNAVAILABLE); }