summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator.cpp
diff options
context:
space:
mode:
authorDavid Pursell <dpursell@google.com>2018-03-28 22:16:24 +0000
committerDavid Pursell <dpursell@google.com>2018-04-03 21:20:47 +0000
commit5631f665a6d048c92e0ba76932885a11a71c8751 (patch)
tree34a116740975483f005840d5acdc9a25c4a9311c /tools/aapt2/java/JavaClassGenerator.cpp
parenta43cedbf25d3fd25c591fd1c6a1ae8c117f49bc3 (diff)
MessageQueue: explicitly remove FD event listeners.
When removing an FD listener from a MessageQueue, the MessageQueue waits until the next event callback on that FD to remove it from the underlying native Looper. This works as expected most of the time, but due to the epoll rebuild logic in the native Looper, there is a rare condition where FDs can get stuck in the Looper: 1. Register two or more FD listeners. 2. Unregister FD1 listener and close FD1. 3. Before the Looper processes FD1, get an event on FD2 and close it. (3) will trigger a rebuild of the epoll set but as FD1 is no longer valid it cannot be added back to the epoll set, and the MessageQueue will never get the final callback to clean it up. Each time this happens: * There is a small memory leak (24-32 bytes) in native Looper * Rebuilding the epoll set incurs slightly more processing * An error is logged for each lost FD on each epoll rebuild This is fairly minimal, and does get cleaned up if the lost FDs is re-opened during an epoll rebuild (since it can now be added back in), but worst-case if a process somehow triggers this on a large number of FDs it might be noticeable. It seems worth it to just remove the FD explicitly right away to avoid this case altogether. Bug: 64083817 Test: [aosp_x86-userdebug emulator] adb shell am instrument -w \ -e class android.os.cts.MessageQueueTest \ android.os.cts/android.support.test.runner.AndroidJUnitRunner Change-Id: I5093ca0d576473f490347ab4244af11a2835d23a (cherry picked from commit 57f25ad657598248888b664454ac590b2ade3967)
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
0 files changed, 0 insertions, 0 deletions