Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123386 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 5DE9A1A009C for ; Tue, 21 May 2024 19:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716318392; bh=v4Tv7P/xHTMJjbIb2vafxa/DmG9jWH8gD3J4IykVPvM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=BBy3g8SlC4JixvE47xicTfMFIrdXS/6Vv+84L3SGG+QUT31odHW5NSY16USuroga4 2QTMewjDeGvSCJlkIgsPRPG1aSU/me9brHtE87Cj1zMOYRzJD2X6rY+Fb4SyqsTSXr JpD1hWuWIDbtcn2CWSDB3n6fIM7TxSKRjYpnr17LtWOGH37q/GuxQjFvQwAxyAwxrY en4s25CtPad/TDZ7uF6TkMN2atyB3mTG59EhnGfpRVtSTZ5OJqzCPQSL53iB80xN95 ccsC/j+Mmz+FGg/SP/0cOvIMpQNGAaZy5UUWNM3AShtqhMDRMnUCUyRlPNrYrGIy/2 8o5px0ISgibkw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 232C21807C8 for ; Tue, 21 May 2024 19:06:32 +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,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (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 ; Tue, 21 May 2024 19:06:31 +0000 (UTC) Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5b2a66dce8fso3512209eaf.1 for ; Tue, 21 May 2024 12:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20230601.gappssmtp.com; s=20230601; t=1716318335; x=1716923135; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=v4Tv7P/xHTMJjbIb2vafxa/DmG9jWH8gD3J4IykVPvM=; b=hl+ZsIusKvk/vIG9P12GNfjRlQB2nduCvoPQPKiL0Phv3IFhSeXHU+xz17/e9hF05J MIG+SOnvxz7T9bjEaNko1ghw3Kqi4h7EN57jC2iFaOlOI76AQRHabYov0L3R0Rj1tUx8 nXYBAW15MjsBStJrFlZIvkFqdPAABZeeliq0Qo6IiW2lk5ShuwSQpNJEwRnjHM4U/78l rPDBIVRNKZG9YMBjgqa2b/05j8fZpKZ4oQh52wptskNkDU9U1ULq0GWf+ja2W22hBCbk EDWUb+yXCm3ephr6NmZBQ+Yh5ISkt9B3GLFSlAunB6dKLCKngwgGkS12X7WSRjeVUqku 9eSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716318335; x=1716923135; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v4Tv7P/xHTMJjbIb2vafxa/DmG9jWH8gD3J4IykVPvM=; b=RFdpH73m7oNz4mhGFhqj/O/ma0+cnanPvlitIWDLeIUXwqzkpjELHXa3TLXXwyxopm POP0Y0ZyHCcrGW3FkIgsm+FgREi3S4MD96NcmpVL7J6jh3D5Oz1BmyOalwqXXtTq2ec7 PTXZFTjKbYQ6bD2j7nDXzvvxvRMTo4PDQL0unus5iD/8JWDOsrdxP0srQXplniMZXhGz NBsQJOzJ1z5vMRoI7QJNh13VyFV7MDGln9edTRFuZfYZw2IM3BQMaquObQzFjfuBzDZc Xl5ttspteF92vKcgUosiadZt9sJBsdCXdg8LC4TLLfRPdq4GhtQKApYB+g+vnAtNp/3p kPCg== X-Gm-Message-State: AOJu0YxZtCxM4vZx/AnlRKqvTCY7Sd2fNQ618n9SxEfWYwKxaUHTgWBz 3dGidvVN0NlYKnQtP6c6ttV8pIU39GB5eq0Xj7xrnMbNyvdnHYOf8V98GpIcCrosVwhLky/3NLS xiNgfawwCirMjANksQ5ynZ9XrB8TXJUwy0PAjbQvfB/MRYtK9eNg= X-Google-Smtp-Source: AGHT+IHrtAA6cuCBAmV7aVTcmdqpw0CvZncPM5fs/zFrN+3dALFvo+ZZYZ3ZPipy/Fi1MF0eb3Y/SiSkkbcgn/YR/fk= X-Received: by 2002:a05:6358:5926:b0:186:3fea:b69f with SMTP id e5c5f4694b2df-193bcfe024fmr3514595555d.21.1716318334903; Tue, 21 May 2024 12:05:34 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 21 May 2024 21:05:22 +0200 Message-ID: Subject: Re: [PHP-DEV] Switching max_execution_time from CPU time to wall-clock time and from SIGPROF to SIGALRM To: Arnaud Le Blanc Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000ac8ced0618fb809f" From: kontakt@beberlei.de (=?UTF-8?Q?Benjamin_Au=C3=9Fenhofer?=) --000000000000ac8ced0618fb809f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 17, 2024 at 3:49=E2=80=AFPM Arnaud Le Blanc wrote: > Hi internals, > > 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]. > > 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) > > Apart from fixing the issue, this would introduce the following minor > breaking changes: > > - 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. > > 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 ? > > 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 ? > > [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 > > Best Regards, > Arnaud > For reference: There is also this RFC for max_execution_wall_time that was discussed four years ago. https://externals.io/message/112492#112492 --000000000000ac8ced0618fb809f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, May 17, 2024 at 3:49=E2=80=AF= PM Arnaud Le Blanc <arnaud.lb@gma= il.com> wrote:
Hi internals,

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].

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)

Apart from fixing the issue, this would introduce the following minor
breaking changes:

- 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.

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-c= lock
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 ?

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= ?

[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

Best Regards,
Arnaud

For reference: There is also thi= s RFC for max_execution_wall_time that was discussed four years ago. https://externals.io/messa= ge/112492#112492


--000000000000ac8ced0618fb809f--