[mod_timerfd] Fixed - continue timer loop after receiving a SIGSTOP

When taking a snapshot of a machine which pauses the process, mod_timerfd exits and FreeSWITCH, causing all channels to wait indefinitely.

Check `errno == EINTR` and continue the timer loop.
This commit is contained in:
Aron Podrigal 2025-01-16 10:13:31 -06:00 committed by GitHub
parent 55d8f3ff97
commit 96de8fd377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,7 @@
*/ */
#include <switch.h> #include <switch.h>
#include <errno.h>
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include <sys/epoll.h> #include <sys/epoll.h>
@ -228,8 +229,16 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_timerfd_runtime)
do { do {
r = epoll_wait(interval_poll_fd, e, sizeof(e) / sizeof(e[0]), 1000); r = epoll_wait(interval_poll_fd, e, sizeof(e) / sizeof(e[0]), 1000);
if (r < 0) if (r < 0) {
/* if we had an interrupted system call due to process pause via SIGSTOP, do not exit the timer loop */
if (errno == EINTR) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "epoll_wait interrupted by SIGINT, continue...\n");
continue;
}
break; break;
}
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
it = e[i].data.ptr; it = e[i].data.ptr;
if ((e[i].events & EPOLLIN) && if ((e[i].events & EPOLLIN) &&