From 221de2679cf5437f5e63b2fd59527767074691d5 Mon Sep 17 00:00:00 2001 From: Manuel Kress <6232639+windaishi@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:47:21 +0100 Subject: [PATCH 1/5] Use ITIMER_REAL for timeout handling on Apple Silicon system --- Zend/zend_execute_API.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index fa5e13dba2ea8..8bb0860117ce3 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1522,7 +1522,8 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ t_r.it_value.tv_sec = seconds; t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; -# if defined(__CYGWIN__) || defined(__PASE__) +# if defined(__CYGWIN__) || defined(__PASE__) || defined(__aarch64__) + // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14 setitimer(ITIMER_REAL, &t_r, NULL); } signo = SIGALRM; From 7c7a3a7eba410fee5249984aab584b2a33686859 Mon Sep 17 00:00:00 2001 From: Manuel Kress <6232639+windaishi@users.noreply.github.com> Date: Sat, 2 Mar 2024 18:27:27 +0100 Subject: [PATCH 2/5] Update Zend/zend_execute_API.c --- Zend/zend_execute_API.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 8bb0860117ce3..5354c912ce14f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1522,7 +1522,7 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ t_r.it_value.tv_sec = seconds; t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; -# if defined(__CYGWIN__) || defined(__PASE__) || defined(__aarch64__) +# if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__)) // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14 setitimer(ITIMER_REAL, &t_r, NULL); } From 07e027500a5e9d6ebb3611b39940ff5bee09646d Mon Sep 17 00:00:00 2001 From: Manuel Kress <6232639+windaishi@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:23:04 +0100 Subject: [PATCH 3/5] Add review feedback --- Zend/zend_execute_API.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 5354c912ce14f..4363bab787bf9 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1523,7 +1523,7 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; # if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__)) - // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14 + // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14 setitimer(ITIMER_REAL, &t_r, NULL); } signo = SIGALRM; @@ -1587,7 +1587,7 @@ void zend_unset_timeout(void) /* {{{ */ no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0; -# if defined(__CYGWIN__) || defined(__PASE__) +# if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__)) setitimer(ITIMER_REAL, &no_timeout, NULL); # else setitimer(ITIMER_PROF, &no_timeout, NULL); From bf99e2060fcd7f7a23d7c10aa0dcb0d25a903c01 Mon Sep 17 00:00:00 2001 From: Manuel Kress <6232639+windaishi@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:27:21 +0100 Subject: [PATCH 4/5] Improve comment --- Zend/zend_execute_API.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 4363bab787bf9..2af2ffc04ccf2 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1523,7 +1523,8 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; # if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__)) - // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14 + // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14. The SIGALRM signal is sent way too early + // when the process opens sockets. setitimer(ITIMER_REAL, &t_r, NULL); } signo = SIGALRM; From 88f3a1d25d79110dd1fa0674101f2153b695a7b3 Mon Sep 17 00:00:00 2001 From: Manuel Kress <6232639+windaishi@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:33:36 +0100 Subject: [PATCH 5/5] Update Zend/zend_execute_API.c --- Zend/zend_execute_API.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 2af2ffc04ccf2..d06b80a4d3850 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1523,7 +1523,7 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */ t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0; # if defined(__CYGWIN__) || defined(__PASE__) || (defined(__aarch64__) && defined(__APPLE__)) - // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14. The SIGALRM signal is sent way too early + // ITIMER_PROF is broken in Apple Silicon system with MacOS >= 14. The SIGPROF signal is sent way too early // when the process opens sockets. setitimer(ITIMER_REAL, &t_r, NULL); }