From 49462bfe00b1e3e7083093d00421f41a207eea92 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 13 Jan 2016 11:26:12 -0600 Subject: [PATCH] FS-8726 #resolve [Spurious case of thread stuck and saturating CPU] --- src/switch_apr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_apr.c b/src/switch_apr.c index 8407d42713..fe305d7cd1 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -1014,7 +1014,9 @@ SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t num if (aprset) { st = apr_poll((apr_pollfd_t *) aprset, numsock, nsds, timeout); - if (st == APR_TIMEUP) { + if (numsock == 1 && ((aprset[0].rtnevents & APR_POLLERR) || (aprset[0].rtnevents & APR_POLLHUP) || (aprset[0].rtnevents & APR_POLLNVAL))) { + st = SWITCH_STATUS_GENERR; + } else if (st == APR_TIMEUP) { st = SWITCH_STATUS_TIMEOUT; } }