android_packages_modules_Co.../tests/unit/java/com/android/server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Kangping Dong 36f8b3f6ad [mdns] fix race conditions in MdnsAdvertiser
There is a race condition in MdnsAdvertiser when removing the last
service:
1. When the last service is removed, it will call the destroyNow()
   to tear down the interface advertiser and schedule a onDestroyed()
   callback for MdnsAdvetiser to do further cleanup
2. If another serivce is registered after removing the last service but
   before onDestroyed() is invoked, then onAdvertiserDestroyed() will
   return false and the InterfaceAdvertiserRequest is kept in the map in
   MdnsAdvertiser. This is because the newly registered service is in
   the mPendingRestionstrations.
3. The problem is that InterfaceAdvertiserRequest now have no
   InterfaceAdvertiser (because the only advertiser has already
   destroyed) and cause the newly registered service can't be
   advertised.

It needs to schedule onDestroyed() on the handler thread because we
can't do modify-during-iteration, but this introduces the race condition
here.

The fix in this commit changes to not destroy the InterfaceAdvertiser
immediately when the last service is removed but destroy when there are
no pending registrations in the InterfaceAdvertiserRequest.

Test: atest --iterations 100 CtsNetTestCases:android.net.cts.NsdManagerTest#testRegisterService_registerImmediatelyAfterUnregister_serviceFound
Change-Id: I6b6f01e6ddf103d16a8b0296af000dc8262ea65b
2024-03-13 17:28:35 +08:00
..
connectivity [mdns] fix race conditions in MdnsAdvertiser 2024-03-13 17:28:35 +08:00
connectivityservice Revert "Log bpf rc file if it differs from the template files." 2024-03-05 19:49:20 -08:00
ethernet Connectivity Tests: join handler thread after calling quitSafely 2023-03-17 01:01:09 -07:00
net Use Service handler thread for NetworkStatsObservers 2024-03-06 18:09:03 +08:00
BpfNetMapsTest.java Merge changes Ie1a36c3c,Id727cf7b,Ifba198d9 into main 2023-11-07 19:32:51 +00:00
ConnectivityServiceTest.java Revert "Log bpf rc file if it differs from the template files." 2024-03-05 19:49:20 -08:00
IpSecServiceParameterizedTest.java Reland "Support getting transform state in IpSecService" 2023-12-12 22:19:55 +00:00
IpSecServiceRefcountedResourceTest.java Add some non-connectivity-module-test back to ConnectivityCoverageTests 2022-05-27 07:16:46 +00:00
IpSecServiceTest.java Experimental support for IPv6 UDP encap. 2023-02-08 15:05:07 +09:00
IpSecXfrmControllerTest.java [XFRM_MSG_NEWSA] Support polling SA state with netlink message 2023-12-11 18:43:34 +00:00
IpSecXfrmControllerTestHex.java [XFRM_MSG_NEWSA] Support polling SA state with netlink message 2023-12-11 18:43:34 +00:00
LegacyTypeTrackerTest.kt Build ethernet framework source into framework-connectivity-tiramisu 2022-03-14 14:06:35 +00:00
NetIdManagerTest.kt Address comments on aosp/1781202 2022-08-17 07:11:55 +00:00
NsdServiceTest.java [mdns] add service-side impl for NSD service TTL support 2024-02-28 21:42:37 +08:00