Github user oknet commented on the issue: https://github.com/apache/trafficserver/pull/947 EVENTIO_ERROR means EPOLLHUP | EPOLLERR | EPOLLPRI. EPOLLPRI means OOB or TCP URG is set. You will always receive EPOLLPRI with EPOLLIN. To EPOLLPRI, we need handle READ first and ignore EPOLLPRI, this is what NetHandler does. EPOLLHUP & EPOLLRDHUP reference : http://stackoverflow.com/questions/8707458/epoll-and-remote-1-way-shutdown ``` A socket listening for epoll events will typically receive an EPOLLRDHUP (in addition to EPOLLIN) event flag upon the remote peer calling close or shutdown(SHUT_WR). This does not neccessarily mean the socket is dead. Subsequent calls to recv() will return any unread data on the socket and eventually "0" will be returned to indicate EOF. It may even be possible to send data back if the remote peer only did a half-close of its socket. The one notable exception is if the remote peer is using the SO_LINGER option enabled on its socket with a linger value of "0". The result of closing such a socket may result in a TCP RST getting sent instead of a FIN. From what I've read, a connection reset event will generate either a EPOLLHUP or EPOLLERR. (I haven't had time to confirm, but it makes sense). There is some documentation to suggest there are older Linux implementations that don't support EPOLLRDHUP, as such EPOLLHUP gets generated instead. And for what it is worth, in my particular case, I found that it is not too interesting to have code that special cases EPOLLHUP or EPOLLRDHUP events. Instead, just treat these events the same as EPOLLIN/EPOLLOUT and call recv() (or send() as appropriate). But pay close attention to return codes returned back from recv() and send(). ``` EPOLLERR means the possible non-fatal errors on socket fd such as EAGAIN, EINTR, EWOULDBLOCK and fatal errors. When you receive EPLLERR, it means an error of socketfd and also there may be data before this error. Therefore we should call read() and write() to figure out the actual meanning of this error Currently, NetHandler try to perform read() & write() on the socket fd first. We will get non-fatal errors or fatal erros from read() or write(). if it is non-fatal error, just put socket fd into wait list. if it is fatal error, signal SM to close socket fd. e.g. There is a Fatal ERROR if EPIPE is returned from write(). If "0" is returned from read() there is EOF. So the currently implement of NetHandler is enough to handle all of this and doesn't need to change.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---