Commit 37a2496
Handle return events for poll() (#836)
On MacOS, there was a situation where poll() had POLLHUP in revents,
which was not being handled by WaitForEvent. This caused poll to
continuously run, taking CPU time (up to 100%).
In spite of requesting POLLERR | POLLIN or POLLERR | POLLOUT,
poll will also potentially return POLLHUP and POLLNVAL.
[From the opengroup poll spec:](https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html)
"In addition, poll() shall set the POLLHUP, POLLERR, and POLLNVAL flag in
revents if the condition is true, even if the application did not set the
corresponding bit in events."
We've removed the request for POLLERR from the file descriptor as it is
unnecessary and misleading.
This fix addresses the CPU usage on MacOS 11.6 when running a monitor
that cannot connect to its nodes.
Co-authored-by: Jacob Champion <pchampion@vmware.com>1 parent fc92546 commit 37a2496
1 file changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
748 | 748 | | |
749 | 749 | | |
750 | 750 | | |
751 | | - | |
| 751 | + | |
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
755 | | - | |
| 755 | + | |
756 | 756 | | |
757 | 757 | | |
758 | 758 | | |
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
789 | | - | |
790 | | - | |
| 789 | + | |
791 | 790 | | |
792 | 791 | | |
793 | 792 | | |
| |||
0 commit comments