Skip to content

Commit

Permalink
Report EPOLLERR as is_write_closed (#1350)
Browse files Browse the repository at this point in the history
The epoll_ctl(2) manual says to following about EPOLLERR

    Error condition happened on the associated file descriptor. This
    event is also reported for the write end of a pipe when the read end
    has been closed.

In practice we've seen a number of event variations when the read side
of a Unix pipe(2) is closed, including EPOLLHUP and EPOLLOUT|EPOLLERR.
And now we've also seen just EPOLLERR, without EPOLLOUT.

This caused the process_issue_2174 test to fail in Tokio, currently
found here:
https://github.com/tokio-rs/tokio/blob/078d0a2ebc4d4f88cb6bce05c8ac4f5038dae9be/tokio/tests/process_issue_2174.rs.
  • Loading branch information
Thomasdezeeuw committed Sep 28, 2020
1 parent d555991 commit 0c77b57
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sys/unix/selector/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ pub mod event {
// Unix pipe write end has closed
|| (event.events as libc::c_int & libc::EPOLLOUT != 0
&& event.events as libc::c_int & libc::EPOLLERR != 0)
// The other side (read end) of a Unix pipe has closed.
|| event.events as libc::c_int == libc::EPOLLERR
}

pub fn is_priority(event: &Event) -> bool {
Expand Down

0 comments on commit 0c77b57

Please sign in to comment.