Loading src/lib/bus/bus.c +6 −1 Original line number Diff line number Diff line Loading @@ -361,6 +361,11 @@ static bool poll_on_completion(struct bus *b, int fd) { uint16_t msec = 0; uint8_t read_buf[sizeof(msec)]; if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { BUS_LOG(b, 1, LOG_SENDING_REQUEST, "failed (broken alert pipe)", b->udata); return false; } BUS_LOG(b, 3, LOG_SENDING_REQUEST, "Reading alert pipe...", b->udata); ssize_t sz = read(fd, read_buf, sizeof(read_buf)); Loading @@ -370,7 +375,7 @@ static bool poll_on_completion(struct bus *b, int fd) { if (msec > 0) { BUS_LOG_SNPRINTF(b, 5, LOG_SENDING_REQUEST, b->udata, 64, " -- awakening client thread with backpressure of %d msec", msec); (void)poll(fds, 0, msec); (void)poll(NULL, 0, msec); } BUS_LOG(b, 3, LOG_SENDING_REQUEST, "sent!", b->udata); Loading src/lib/bus/listener.c +2 −2 Original line number Diff line number Diff line Loading @@ -329,9 +329,9 @@ static void attempt_recv(listener *l, int available) { connection_info *ci = l->fd_info[i]; assert(ci->fd == fd->fd); if (fd->revents & POLLERR) { if (fd->revents & (POLLERR | POLLNVAL)) { read_from++; BUS_LOG(b, 2, LOG_LISTENER, "pollfd: socket error POLLERR", b->udata); BUS_LOG(b, 2, LOG_LISTENER, "pollfd: socket error (POLLERR | POLLNVAL)", b->udata); set_error_for_socket(l, i, ci->fd, RX_ERROR_POLLERR); } else if (fd->revents & POLLHUP) { read_from++; Loading src/lib/bus/sender.c +2 −2 Original line number Diff line number Diff line Loading @@ -262,7 +262,7 @@ static bool commit_event_and_block(struct sender *s, tx_info_t *info) { short ev = fds[0].revents; BUS_LOG_SNPRINTF(b, 8, LOG_SENDER, b->udata, 64, "poll: ev %d, errno %d", ev, errno); if ((ev & POLLHUP) || (ev & POLLERR) || (ev & POLLNVAL)) { if (ev & (POLLHUP | POLLERR | POLLNVAL)) { /* We've been hung up on due to a shutdown event. */ close(info->done_pipe); return true; Loading Loading @@ -712,7 +712,7 @@ static void attempt_write(sender *s, int available) { BUS_LOG_SNPRINTF(b, 10, LOG_SENDER, b->udata, 64, "attempting write on %d (revents 0x%08x)", pfd->fd, pfd->revents); if (pfd->revents & POLLERR) { if (pfd->revents & (POLLERR | POLLNVAL)) { written++; set_error_for_socket(s, pfd->fd, TX_ERROR_POLLERR); } else if (pfd->revents & POLLHUP) { Loading src/lib/threadpool/threadpool.c +6 −3 Original line number Diff line number Diff line Loading @@ -165,8 +165,11 @@ bool threadpool_shutdown(struct threadpool *t, bool kill_all) { struct thread_info *ti = &t->threads[i]; if (ti->status < STATUS_SHUTDOWN) { ti->status = STATUS_SHUTDOWN; if (0 != pthread_cancel(ti->t)) { assert(false); int pcres = pthread_cancel(ti->t); if (pcres != 0) { /* If this fails, tolerate the failure that the * pthread has already shut down. */ assert(pcres == ESRCH); } } } Loading Loading @@ -304,7 +307,7 @@ static void *thread_task(void *arg) { int res = poll(pfd, 1, delay); if (res == 1) { if ((pfd[0].revents & POLLHUP) || (pfd[0].revents & POLLERR)) { if (pfd[0].revents & (POLLHUP | POLLERR | POLLNVAL)) { /* TODO: HUP should be distinct from ERR -- hup is * intentional shutdown, ERR probably isn't. */ ti->status = STATUS_SHUTDOWN; Loading Loading
src/lib/bus/bus.c +6 −1 Original line number Diff line number Diff line Loading @@ -361,6 +361,11 @@ static bool poll_on_completion(struct bus *b, int fd) { uint16_t msec = 0; uint8_t read_buf[sizeof(msec)]; if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { BUS_LOG(b, 1, LOG_SENDING_REQUEST, "failed (broken alert pipe)", b->udata); return false; } BUS_LOG(b, 3, LOG_SENDING_REQUEST, "Reading alert pipe...", b->udata); ssize_t sz = read(fd, read_buf, sizeof(read_buf)); Loading @@ -370,7 +375,7 @@ static bool poll_on_completion(struct bus *b, int fd) { if (msec > 0) { BUS_LOG_SNPRINTF(b, 5, LOG_SENDING_REQUEST, b->udata, 64, " -- awakening client thread with backpressure of %d msec", msec); (void)poll(fds, 0, msec); (void)poll(NULL, 0, msec); } BUS_LOG(b, 3, LOG_SENDING_REQUEST, "sent!", b->udata); Loading
src/lib/bus/listener.c +2 −2 Original line number Diff line number Diff line Loading @@ -329,9 +329,9 @@ static void attempt_recv(listener *l, int available) { connection_info *ci = l->fd_info[i]; assert(ci->fd == fd->fd); if (fd->revents & POLLERR) { if (fd->revents & (POLLERR | POLLNVAL)) { read_from++; BUS_LOG(b, 2, LOG_LISTENER, "pollfd: socket error POLLERR", b->udata); BUS_LOG(b, 2, LOG_LISTENER, "pollfd: socket error (POLLERR | POLLNVAL)", b->udata); set_error_for_socket(l, i, ci->fd, RX_ERROR_POLLERR); } else if (fd->revents & POLLHUP) { read_from++; Loading
src/lib/bus/sender.c +2 −2 Original line number Diff line number Diff line Loading @@ -262,7 +262,7 @@ static bool commit_event_and_block(struct sender *s, tx_info_t *info) { short ev = fds[0].revents; BUS_LOG_SNPRINTF(b, 8, LOG_SENDER, b->udata, 64, "poll: ev %d, errno %d", ev, errno); if ((ev & POLLHUP) || (ev & POLLERR) || (ev & POLLNVAL)) { if (ev & (POLLHUP | POLLERR | POLLNVAL)) { /* We've been hung up on due to a shutdown event. */ close(info->done_pipe); return true; Loading Loading @@ -712,7 +712,7 @@ static void attempt_write(sender *s, int available) { BUS_LOG_SNPRINTF(b, 10, LOG_SENDER, b->udata, 64, "attempting write on %d (revents 0x%08x)", pfd->fd, pfd->revents); if (pfd->revents & POLLERR) { if (pfd->revents & (POLLERR | POLLNVAL)) { written++; set_error_for_socket(s, pfd->fd, TX_ERROR_POLLERR); } else if (pfd->revents & POLLHUP) { Loading
src/lib/threadpool/threadpool.c +6 −3 Original line number Diff line number Diff line Loading @@ -165,8 +165,11 @@ bool threadpool_shutdown(struct threadpool *t, bool kill_all) { struct thread_info *ti = &t->threads[i]; if (ti->status < STATUS_SHUTDOWN) { ti->status = STATUS_SHUTDOWN; if (0 != pthread_cancel(ti->t)) { assert(false); int pcres = pthread_cancel(ti->t); if (pcres != 0) { /* If this fails, tolerate the failure that the * pthread has already shut down. */ assert(pcres == ESRCH); } } } Loading Loading @@ -304,7 +307,7 @@ static void *thread_task(void *arg) { int res = poll(pfd, 1, delay); if (res == 1) { if ((pfd[0].revents & POLLHUP) || (pfd[0].revents & POLLERR)) { if (pfd[0].revents & (POLLHUP | POLLERR | POLLNVAL)) { /* TODO: HUP should be distinct from ERR -- hup is * intentional shutdown, ERR probably isn't. */ ti->status = STATUS_SHUTDOWN; Loading