--- libaitsched/src/hooks.c 2021/06/08 21:45:07 1.35 +++ libaitsched/src/hooks.c 2022/10/17 22:38:26 1.35.4.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.35 2021/06/08 21:45:07 misho Exp $ +* $Id: hooks.c,v 1.35.4.1 2022/10/17 22:38:26 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -1186,6 +1186,13 @@ fetch_hook_epoll_proceed(int en, struct epoll_event *r } if (epoll_ctl(r->root_kq, ops, evt->data.fd, evt) == -1) { + if (errno == EBADF) { + epoll_ctl(r->root_kq, EPOLL_CTL_DEL, evt->data.fd, evt); + schedCancelby(r, taskREAD, CRITERIA_FD, + (void*) (uintptr_t) evt->data.fd, NULL); + schedCancelby(r, taskWRITE, CRITERIA_FD, + (void*) (uintptr_t) evt->data.fd, NULL); + } if (r->root_hooks.hook_exec.exception) { r->root_hooks.hook_exec.exception(r, NULL); } else