Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126666 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 CACB71A00BC for ; Sat, 8 Mar 2025 23:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741475979; bh=u+lWxNDt3qz3xir4sjsSqQ69sLxaSmLJdSv/rGuHlWM=; h=Date:From:To:In-Reply-To:References:Subject:From; b=JFiyYHMBvbwvwhxUDXDGoG7eg/pMBXzRm/LEhAcU/LZNycVxd/VQ5Z6LQMZ+FKdHd oRXE0yYcofBTOJnOzlKKxjyAMw+rPUeOebPejmV8LC60xnl4228xRdwyLjKbV5u767 ovP87wptbqfCzYFZsakKbAvqLKpQ0wFV6wSQ3lMQkj5I5Y7AWOQVamJEvVadD9cmkF 9GMudULGiaScNCx9n79ak3KX2dDGGwfMJgZ5QSWgi4X+HAE1VpHpZoZutXw1i8lK4/ QPBho//vMSXGm1c+c/h0zlCbuOCwcZmizELsJce0CQlgQ3WIf3gag1UIvEb6zyEFJ9 TiQb/6Htmfs/A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D221F180072 for ; Sat, 8 Mar 2025 23:19:38 +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=-1.2 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 ; Sat, 8 Mar 2025 23:19:38 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5e5bc066283so4659203a12.0 for ; Sat, 08 Mar 2025 15:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741476132; x=1742080932; darn=lists.php.net; h=mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=0MgO6thvl1tgqrUAjpHmGzpJpPn0eSZVJJXcCqEecwQ=; b=YEqC3q6im+uVt6D1Pw9minnilnrvNOeFcPC6bp+h5fLMv/Vy1gFVAVajcjPW3amygw tJiaQQQf+68M/I+4vKXdXuf+UsGMv7hjqUyXRw0hl/O1aTIIIPLm/I47dshfzesan5z9 2bftqwnAJf3/2MC3U1iRXgbM3OjR0hKko/HXSKfKqd3Zu0jsLBooxSfCFVVOjKOtGis6 g+Oh799ofyT9Y89RKPFItzuynNebZcsEsch6uSS329Ku21c19s0Y+I7OQDvcmkuIFl7P B2t6QBwwDSPRO+e37+32hRWj4lAYZmqHVJDOXoJouI/ZS9EEqtw7l//g9Oq2c/r7QoXh ofcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741476132; x=1742080932; h=mime-version:subject:references:in-reply-to:message-id:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0MgO6thvl1tgqrUAjpHmGzpJpPn0eSZVJJXcCqEecwQ=; b=P9RtNffhr5312EDzvHXuSfDrAJBz7nKxRdo1Jlstt7M8xIoezqlATDdC7ekN6u2dzD eEAzHftXiXPEsbubE8hzFirxF0HXMVqcPX1KXUncwsZb9RrLnZDaQEc2Nrj4SU96UeI+ s49ZaYoSMYzefcDzoNjd/tQqpepklP00pJqzzySKXYK9Hu697/IvPwTziA1QKW7ik7WE ar8aDpYFlXau/aQuuajSdaVfBn2c1YMBB2zz6Tg7rMU+5/IvLB7JzXr0bW3oSQaRnYLv WO4LImbAiUh1P2h0p6/TtrO+zbOBLg2lEbKs5kNE6L3eidapkWg91xGfcXl3v3oYX0Wk MlSw== X-Gm-Message-State: AOJu0Yy9Vm017tt2qt8p4FRUcc5vL6h/ClaeuMknmwAcV+3JBaX7dfFV UJNxcqAqQskzfBu6WJjmEZFab4kkgrKLvAZELr/g/sZCCujMP/ypji+vdg== X-Gm-Gg: ASbGncvmLwhPMl8BpvuCJ2qHTJxfLmgnuF6qqEuC2vpNZ28VAxXJdbjqa/D8e9ClNhm LiJtEyd2FekCkcuqKqr8wqlGgbPRo2n5e608E83KPuMSSdsSIMuc5RD2QLKVADBtfa8T5aATWRv rukhEQjacGMuw0EjD4477FLX65NAjDIqxH+PEwN51psKUVi/Qufjw3h5TOrM2TbQEIAMwh/d7Hm K6xkIvYyV5FX7NhcBLx2vcpWnQp+x0kADdyJPbnu8byUtVMIaxYCob1M451iYXr5mCcMn4agqLL HolzuGHQ4dV9sXO95bSCFCb1eqebdgtyYiq3pcVIZAxrk8Y7J4pcV5jGQfDpSvScwQZ1UjTUuvm jPDzy/Wilu5vAapl8IGf4clYjcPXU X-Google-Smtp-Source: AGHT+IGM2H1xKdNbP5GhJ/tvJn4kWdbrGYxLFwUsWnQ5UE9//qDcScfM+RY6wQGh1Rd72EThwydS/g== X-Received: by 2002:a05:6402:3785:b0:5e6:180b:557d with SMTP id 4fb4d7f45d1cf-5e6180b5925mr4570770a12.11.1741476131607; Sat, 08 Mar 2025 15:22:11 -0800 (PST) Received: from ?IPv6:::1? (luna-749a6f85f554075d0000f.net.as198747.daniil.it. [2a0e:97c0:38f:0:d570:455f:58f6:a947]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5e5c7669ffcsm4480223a12.55.2025.03.08.15.22.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Mar 2025 15:22:11 -0800 (PST) Date: Sun, 9 Mar 2025 00:22:08 +0100 (GMT+01:00) To: internals@lists.php.net Message-ID: <4690cff0-7a48-4fe0-8310-688be253f976@gmail.com> In-Reply-To: References: <78a03dd0-fd4a-4f4a-ad8a-37e5704f06fc@app.fastmail.com> <08c8ad0b-e8f4-46e3-99f0-b80748d40b89@app.fastmail.com> <07973EAE-2D83-47A8-8FA0-84286C77C02B@rwec.co.uk> <48d66433-3ae9-4895-8361-7c81a0a3670d@app.fastmail.com> <8599eb8b-d4a3-4cb8-899a-25b134e0d64d@gmail.com> <74c4c726-63aa-44e0-84c9-840e13a65a4f@gmail.com> <77DC5F50-531D-49E8-8BE2-504A19CB5FFD@rwec.co.uk> <676e36e4-0b84-4d8c-b3db-2998831cd79d@gmail.com> <510B8EF1-9D07-41A8-9EA0-7D99CF7BFC91@rwec.co.uk> Subject: Re: [PHP-DEV] PHP True Async RFC Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5_248741874.1741476128356" X-Correlation-ID: <4690cff0-7a48-4fe0-8310-688be253f976@gmail.com> From: daniil.gentili@gmail.com (Daniil Gentili) ------=_Part_5_248741874.1741476128356 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit > Offering this tool to userland is a major footgun that will either backfire spectacularly (breaking existing and new async libraries by endlessly awaiting upon background fibers when exiting an async {} block haphazardly used by a newbie, or even worse force library developers to reduce concurrency, killing async PHP just because users can use async {} blocks), or simply not get used at all (because the main SAPI usecase listed explicitly does NOT need purity). Some extra points: 1) The naming of "async {}" is also very misleading, as it does the opposite of making things async, if anything it should be called "wait_all {}" 2) Again, what are waiting for? A fiber spawned by a library we called 10 levels deep in the stack, that exits only when the container object is destroyed (outside of the wait_all block, thus causing an endless hang)? No one should care or be able to control what must remain an internal implementation detail of invoked libraries, adding a wait_all block will only break stuff. 3) If we did want to wait for all fibers spawned by a method call, nothing is preventing the caller from returning an array of futures for spawned fibers that we can await. The wait_all block is EXPLICITLY DESIGNED to meddle with the internals of async libraries, because the only feature it offers (that isn't already offered by awaitAll) is one that controls internal implementation details of libraries invoked within the block. Libraries can full well handle cleanup of fibers in __destruct by themselves, without a wait_all block forcing them to reduce concurrency whenever the caller pleases. It is, imo, a MAJOR FOOTGUN, and should not be even considered for implementation. Regards, Daniil Gentili. ------=_Part_5_248741874.1741476128356 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
> Offering this tool to userland is a major footgun that will either backfire spectacularly (breaking existing and new async libraries by endlessly awaiting upon background fibers when exiting an async {} block haphazardly used by a newbie, or even worse force library developers to reduce concurrency, killing async PHP just because users can use async {} blocks), or simply not get used at all (because the main SAPI usecase listed explicitly does NOT need purity).

Some extra points:

1) The naming of "async {}" is also very misleading, as it does the opposite of making things async, if anything it should be called "wait_all {}"

2) Again, what are waiting for? A fiber spawned by a library we called 10 levels deep in the stack, that exits only when the container object is destroyed (outside of the wait_all block, thus causing an endless hang)? No one should care or be able to control what must remain an internal implementation detail of invoked libraries, adding a wait_all block will only break stuff.

3) If we did want to wait for all fibers spawned by a method call, nothing is preventing the caller from returning an array of futures for spawned fibers that we can await.

The wait_all block is EXPLICITLY DESIGNED to meddle with the internals of async libraries, because the only feature it offers (that isn't already offered by awaitAll) is one that controls internal implementation details of libraries invoked within the block.

Libraries can full well handle cleanup of fibers in __destruct by themselves, without a wait_all block forcing them to reduce concurrency whenever the caller pleases.

It is, imo, a MAJOR FOOTGUN, and should not be even considered for implementation.

Regards,
Daniil Gentili.
------=_Part_5_248741874.1741476128356--