mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MEDIUM: epoll: skip reports of stale file descriptors
Now that we can see that some events are reported for older instances of a file descriptor, let's skip these ones instead of reporting dangerous events on them. It might possibly qualify as a bug if it helps fixing strange issues in certain environments, in which case it can make sense to backport it along with the following recent patches: DEBUG: fd: add a counter of takeovers of an FD since it was last opened MINOR: fd: add a generation number to file descriptors DEBUG: epoll: store and compare the FD's generation count with reported event
This commit is contained in:
parent
5012b6c6d9
commit
8235a24782
@ -266,7 +266,9 @@ static void _do_poll(struct poller *p, int exp, int wake)
|
|||||||
fd_gen = _HA_ATOMIC_LOAD(&fdtab[fd].generation);
|
fd_gen = _HA_ATOMIC_LOAD(&fdtab[fd].generation);
|
||||||
|
|
||||||
if (unlikely(ev_gen != fd_gen)) {
|
if (unlikely(ev_gen != fd_gen)) {
|
||||||
/* this is a stale report for an older instance of this FD */
|
/* this is a stale report for an older instance of this FD,
|
||||||
|
* we must ignore it.
|
||||||
|
*/
|
||||||
|
|
||||||
if (_HA_ATOMIC_LOAD(&fdtab[fd].owner)) {
|
if (_HA_ATOMIC_LOAD(&fdtab[fd].owner)) {
|
||||||
ulong tmask = _HA_ATOMIC_LOAD(&fdtab[fd].thread_mask);
|
ulong tmask = _HA_ATOMIC_LOAD(&fdtab[fd].thread_mask);
|
||||||
@ -297,6 +299,7 @@ static void _do_poll(struct poller *p, int exp, int wake)
|
|||||||
} else {
|
} else {
|
||||||
COUNT_IF(1, "epoll report of event on a just closed fd (harmless)");
|
COUNT_IF(1, "epoll report of event on a just closed fd (harmless)");
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((e & EPOLLRDHUP) && !(cur_poller.flags & HAP_POLL_F_RDHUP))
|
if ((e & EPOLLRDHUP) && !(cur_poller.flags & HAP_POLL_F_RDHUP))
|
||||||
|
Loading…
Reference in New Issue
Block a user