From 35356e9d9bd92810da88970181f6cb982a877c91 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Wed, 26 Jul 2023 22:51:26 +0900 Subject: [PATCH] Fixed SIGPIPE problem (#2411, #2312) --- lib/core/ogs-epoll.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/core/ogs-epoll.c b/lib/core/ogs-epoll.c index 5e7b087d8..833f64975 100644 --- a/lib/core/ogs-epoll.c +++ b/lib/core/ogs-epoll.c @@ -227,7 +227,22 @@ static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout) received = context->event_list[i].events; if (received & EPOLLERR) { + /* + * The libevent library has OGS_POLLOUT turned on in EPOLLERR. + * + * However, SIGPIPE can occur if write() is called + * when the peer connection is closed. + * + * Therefore, Open5GS turns off OGS_POLLOUT + * so that write() cannot be called in case of EPOLLERR. + * + * See also #2411 and #2312 + */ +#if 0 when = OGS_POLLIN|OGS_POLLOUT; +#else + when = OGS_POLLIN; +#endif } else if ((received & EPOLLHUP) && !(received & EPOLLRDHUP)) { when = OGS_POLLIN|OGS_POLLOUT; } else {