--- libaitsched/src/hooks.c 2021/06/08 21:45:07 1.35 +++ libaitsched/src/hooks.c 2022/10/17 22:45:06 1.36 @@ -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.36 2022/10/17 22:45:06 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2021 +Copyright 2004 - 2022 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -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