Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123336 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id EC11F1A009C for ; Fri, 17 May 2024 17:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715967797; bh=rGyEe19NnfL44H0YDqglIsK2wUbIg1QU3Ra0k5naTko=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=MIghqg0rtYsbENfAEUDbK7BuxUtCN9jD+LJnUvldVObdIPuO/ERWqWMtVd/kWHbG5 NxzWk3JE7GDBSxCXl/KyXcDEFpzkuFregQp2lN4TprXP0EiOIvJ7dLnAve+6sj39G3 pSD/VLTeX4vpKvFFvWiqtEFjj6mCfOAbnT0jYLz0OieZ6JUOmFkH8hyTk23ZA4NP5F BtUg2FwOZaQRUPEWF2QzaZMjIOXAvaKRJfzlNtS6uNy5O8gC34/GtGFV8pD0QZCmIH ZpKDZGv+mMrSucPi/bOmS27Q59XwO3/66ybGH6NLopYfgEG53L66iKWkyr5K0Nm/hr m19dZSI7UGyIw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D79E6180550 for ; Fri, 17 May 2024 17:43:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from supercat.cmpct.info (supercat.cmpct.info [71.19.146.230]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 17 May 2024 17:43:15 +0000 (UTC) Received: from smtpclient.apple (fctnnbsc38w-142-162-55-237.dhcp-dynamic.fibreop.nb.bellaliant.net [142.162.55.237]) by supercat.cmpct.info (Postfix) with ESMTPSA id BA2524EE73; Fri, 17 May 2024 17:42:19 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Subject: Re: [PHP-DEV] Switching max_execution_time from CPU time to wall-clock time and from SIGPROF to SIGALRM In-Reply-To: Date: Fri, 17 May 2024 14:42:07 -0300 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Arnaud Le Blanc X-Mailer: Apple Mail (2.3774.500.171.1.1) From: calvin@cmpct.info (Calvin Buckley) On May 17, 2024, at 10:47=E2=80=AFAM, Arnaud Le Blanc = wrote: >=20 > Hi internals, >=20 > There is an issue with max_execution_time on MacOS, probably only > MacOS 14 on Apple Silicon, that causes timeouts to fire too early [1]. > max_execution_time is implemented with setitimer(ITIMER_PROF) on this > platform, and the SIGPROF signal is delivered too early for some > reason. Switching to ITIMER_REAL appears to fix the issue, and Manuel > Kress opened a PR [3]. >=20 > Are there objections against switching to ITIMER_REAL on MacOS (Apple > Silicon only) in all currently supported PHP versions? (next 8.2.x, > 8.3.x, 8.x) >=20 > Apart from fixing the issue, this would introduce the following minor > breaking changes: >=20 > - max_execution_time on MacOS would be based on wall-clock time rather > than CPU time, so the time spent in I/O, sleep(), and syscalls in > general would count towards the max_execution_time > - The SIGALRM signal would be used instead of the SIGPROF signal > (using SIGALRM conflicts with pcntl_alarm(), but SIGPROF conflicts > with profilers). As noted by Dmitry, it also conflicts with sleep() on > some platforms, however this should be safe on MacOS. >=20 > Currently max_execution_time is based on wall-clock time on ZTS and > Windows, and CPU time otherwise. On Linux and FreeBSD, wall-clock time > can also be used when building with > --enable-zend-max-execution-timers. M=C3=A1t=C3=A9 proposed to add a = wall-clock > based timeout in the past [2] but the discussion has stalled. Any > thoughts about eventually switching other platforms to wall-clock > timeouts in the next 8.x ? >=20 > TL;DR: > - Any objection about using wall-clock max_execution_time and SIGALRM > on MacOS Apple Silicon in all supported versions? > - Thoughts about using wall-clock timeouts on all platforms in the = next 8.x ? >=20 > [1] https://github.com/php/php-src/issues/12814 > [2] https://github.com/php/php-src/pull/6504 > [3] https://github.com/php/php-src/pull/13567 >=20 > Best Regards, > Arnaud FWIW, Cygwin and IBM i are also using wall time, because these platforms don't do execution time. IIRC, the difference between platforms with how max_execution_time is counted doesn't seem to be documented last I = checked.=