Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123331 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 B6C481A009C for ; Fri, 17 May 2024 13:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715953693; bh=r0jVHVnWpgWDiqRdNVqaVyanUurtIbZ85TrIbYLmSso=; h=From:Date:Subject:To:From; b=DUKiY9d27q8eTipxWXWs930ykhLyHM8MfTrutjoFHV9EhPmzHtcfjDEbjy69uPcMZ J8LwEaqjhC2iYfFrWJpZxFrKPq5DRg7CBJ6Bd6NymsQGxbX2XDapT8tlj/6S77S2c7 BQblo+T3tQHGhN+QNxQV9LTvD/3/umLZWvsciyQSuCzfV9650uNRJ1P+7onE+hqH7V MfbTr+wY1kNsU0cDRtSSXaVQ9yOhLfya0opmkHtxe2ULIAfHdFawzOLO+PFDroWycI 0feOiF22GxNOqcwl6u2lS92dYREzaqXV6v5K+TaJNPdakRfHj6szdWgdlQI8KVVXGK dHDCiFW9KZygQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 46EA218003B for ; Fri, 17 May 2024 13:48:13 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 13:48:09 +0000 (UTC) Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-573061776e8so4954357a12.1 for ; Fri, 17 May 2024 06:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715953635; x=1716558435; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=r0jVHVnWpgWDiqRdNVqaVyanUurtIbZ85TrIbYLmSso=; b=ln5ANu4KlNAO3nJPEVCM85WCtRqJfZnThkryA1OAeyoOs6sOxaykddDzNJvkkeksPi GwgtY0CgdRDcqZzxvDLmfSg2OlU36Uhc7f+EMiJ6haD1Ales4k7IFac3b6O1swSC6+tT 4yjhZvGpJ/fmM5dNiqngFKKMrOlYFEpz4xjsz5DeA5mf3bRNE2g9iRqeRKWbMQJnDc+h eqYIHCaoRQ+hfJJddsvTWNosEkSegayOsuIeyoa14jmZtH+5dpC74UfAcWpM8duJqVSR /vYSQ2m7L4s3bKn7Ljqs9jzCTfQXf1TecEH8Fm1xbmQ4HoRimD5JwxhOuyrg0K8Kt7e2 ZNRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715953635; x=1716558435; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r0jVHVnWpgWDiqRdNVqaVyanUurtIbZ85TrIbYLmSso=; b=mst8WM9Y26Yzvl0Yzc8IznadBoEP1BuOaLCpENelmNFEMu/OQYCLHAWkweSyJfQUPc KfmKc0/AHEDkAk0cwGUZ45jJ5Oj3k5PwOkyBOWydKOhl1byPx8FajvET1eLo+v7x26vV EPHFXVqQvgApTfXp51+nOuMjMF+e1xzFxlqIbr49VzAqc6huCNMAw3NXyayvTI2Xbofy Y8aAltbvEjd4IGT39BR8J1iHcSYxyOJDCvfXGC9Vf8hVHrXtp2bUOxllJtNsmwLTa7Kx FXwkVsgtAl0LsNzI9rgQFoq4x5RZgJmeZZxypFgg76TDfYPUFwofl0xlr146gpngBE3j JSCg== X-Gm-Message-State: AOJu0Yw0CtSM/mnJXLZjiCTClmvWrX5JKM4/6bjPspBhm3Wy1RP+LhIW ijoGVA4RMEiLwYWaCxtW397ppyb0hhorrjFgzDX5iiHkGDS2RRfhnujU7CaMtelK24+RfVvyeau q1ZYz0mDRA/+/eWLgQ0fKSvriy86pJHI1 X-Google-Smtp-Source: AGHT+IEBEW2PTRPfXcs01YP07M5EY5FQo8y+UghtjcuWaQGcMFitn1HmU894mePcGW3ecEr20OhaREhRicotnUlO4ik= X-Received: by 2002:a17:906:fc05:b0:a59:ae9b:c661 with SMTP id a640c23a62f3a-a5a2d5d49b3mr1322816566b.40.1715953634396; Fri, 17 May 2024 06:47:14 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Date: Fri, 17 May 2024 15:47:03 +0200 Message-ID: Subject: [PHP-DEV] Switching max_execution_time from CPU time to wall-clock time and from SIGPROF to SIGALRM To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: arnaud.lb@gmail.com (Arnaud Le Blanc) 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