summaryrefslogtreecommitdiffstats
path: root/libutils/Looper.cpp
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2015-05-29 17:40:25 -0700
committerJeff Brown <jeffbrown@google.com>2015-05-29 17:40:25 -0700
commit18a574f715b767ee8a2f02903c883d571b42409f (patch)
tree8ccf231841dccdf45505b19149b8b0798895f6ec /libutils/Looper.cpp
parent7eb3abdb3ba500d3acca82b95705f34128251015 (diff)
downloadsystem_core-18a574f715b767ee8a2f02903c883d571b42409f.zip
system_core-18a574f715b767ee8a2f02903c883d571b42409f.tar.gz
system_core-18a574f715b767ee8a2f02903c883d571b42409f.tar.bz2
Work around spurious epoll notifications.
Sometimes it seems like we can get into a situation where we are unable to remove an fd from the epoll set but it keeps sending us events anyhow. Defensively rebuild the epoll set in this case to prevent us from spinning forever. Bug: 21271428 Change-Id: I5607e565f2e12460d7113a1f62a70d38d334e271
Diffstat (limited to 'libutils/Looper.cpp')
-rw-r--r--libutils/Looper.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp
index e69784d..5b0ff3a 100644
--- a/libutils/Looper.cpp
+++ b/libutils/Looper.cpp
@@ -567,7 +567,12 @@ int Looper::removeFd(int fd, int seq) {
#endif
scheduleEpollRebuildLocked();
} else {
+ // Some other error occurred. This is really weird because it means
+ // our list of callbacks got out of sync with the epoll set somehow.
+ // We defensively rebuild the epoll set to avoid getting spurious
+ // notifications with nowhere to go.
ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno);
+ scheduleEpollRebuildLocked();
return -1;
}
}