Fix RouterAdvertisementDaemon thread leakage problem
[Prerequisites] Default value of mRaLength is 0, so getNextMulticastTransmitDelaySec() returns DAY_IN_SECONDS (1 day) in this scenario. [Issue Details] Examine MulticastTransmitter.run() for detail: 676 public void run() { 677 while (isSocketValid()) { 678 try { 679 Thread.sleep(getNextMulticastTransmitDelayMs()); Invoke RouterAdvertisementDaemon.stop() here. Since MulticastTransmitter is in a sleep, this thread will pend 1 day until the next check of isSocketValid() triggers the quit action, which causes thread leakage during Wi-Fi Hotspot on/off stress test. 680 } catch (InterruptedException ignored) { [Solution] Invoke maybeNotifyMulticastTransmitter() after closing socket in RouterAdvertisementDaemon.stop() to interrupt MulticastTransmitter from waiting. Bug: 123491872 Test: FrameworksNetTests adb shell am instrument -w com.android.frameworks.tests.net Test: CTS - CtsNetTestCases ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCases Test: CTS - CtsNetTestCasesLegacyApi22 ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCasesLegacyApi22 Test: CTS - CtsNetTestCasesLegacyPermission22 ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCasesLegacyPermission22 Change-Id: I0c0d63b43a88e1026aaecfc1853309ad63f62268
Loading
Please register or sign in to comment