Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:126554
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 827AB1A00BC
	for <internals@lists.php.net>; Mon,  3 Mar 2025 16:03:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1741017665; bh=ba6ca6EbPYBEsXUAjprtS4CXT0b9K7/UryFT0+WstWA=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
	b=SvO4S27rHBrP0pB/cpF7l/hc49jRZ6rATfDM1Ea3xi+8t4R9imfgNHv+IEoH1/XTv
	 hv2r8zVBnYHCMDNOdQQZovhLYp1o41GdHoDc7JZvi9k2PovoT+JC0uOogQ4KWt3+wG
	 dbXoHwJL34MsQvLkjS9WjhiwgadjEjWypwCCRXgXa3F7YdjQTN7BijXU5zYpbhdh1O
	 Z5ROS5ARIWB13u7+l9TIxpGR1sywwd96MxN6mczBhoPoI8BsMdejR/txnosiFy+VYb
	 FsQUdtzBKWNwd9sRFqY+CtbWbxwld3WsDcjDHmDtPRMzmRbTzog8B5ukMBfdX/IX5c
	 JXCHu5Q3ksZfA==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id C9CDA180088
	for <internals@lists.php.net>; Mon,  3 Mar 2025 16:01:04 +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: <nicolas.grekas@gmail.com>
Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173])
	(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 <internals@lists.php.net>; Mon,  3 Mar 2025 16:01:04 +0000 (UTC)
Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e5dc299dee9so4124069276.3
        for <internals@lists.php.net>; Mon, 03 Mar 2025 08:03:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1741017820; x=1741622620; 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=ba6ca6EbPYBEsXUAjprtS4CXT0b9K7/UryFT0+WstWA=;
        b=Ch9vgwmg+FTFEdAfVG3Dw5so+o4AkoQlwwoyzW5+fS/AZ0pyqGGZcvG/UYrJImHoZD
         3Ui00nxPliBEIm+bXuiUfjxDsiKSBzw1XJC8BU+nnvrSbEHAg9pOEqruKmFpO/xl1Q1Y
         rSjwjLH1ziekYcix7SAX5TSA+2jjersRoxaeVV27orHDw7cv4MzbUNE/Skp+ZV3JE7EJ
         O1QLuGqvB9VTylEJ0k9+4Iwhchc7trP/3T+pEBkopB6+u55/8XaAiEwE5UnblHVEom5Q
         Ut/r9KhYr4StWnci3wCSuKXUCDcC1/EK7gUy0iUfDoMCKTq1ZP17l9xe1Duw1Ue8CE5r
         fHeA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1741017820; x=1741622620;
        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=ba6ca6EbPYBEsXUAjprtS4CXT0b9K7/UryFT0+WstWA=;
        b=g4vzxs3XCQFTN0KvR+GKmy8CejN+3zEAQPMJmikja182wo688MU6pZYCLoYz34/upP
         FqZTGCVZNcsD5ef0keePQY1mFnvX4zmAoDr2BZ+1ykKhhLwWZkGmmL2P7vO1aZoJ8TnW
         nu+Puu1uvLczeQXsN2pBkj2qvweBM+ezMRBwtkAKqI99oyKHmnC4SIgyRu/dgPbx3brt
         9dxc6GQyjl/bseobSgPDG27j8KWhoaWuC6xHtHZbrpf+LUr3muWDgB8Fl16y0ZiucXYV
         axzHtnRwU2QwOQKzWOxuev0sZX1YMdcLhUFs2ZxUk4zQ522BGKKkU80beT1ZNDwYyzZd
         PX+Q==
X-Forwarded-Encrypted: i=1; AJvYcCVkDKWhvH3NM5IZlXchWLjNB0gXMWeykKhJVxRqDennMnvylC3UvMMSSJXRHcCm+dS0V/kcc8DqGIw=@lists.php.net
X-Gm-Message-State: AOJu0YxArYGm1vJq2PZzbtFh/MRLcLtuaerWfkLCR5UVaONRi3A6Zy97
	VEpsO9WU9Lntt6cLprzsVOiQdxGd67gnLsUexjecVm/tgCUiRmE9fLEydGlM0hEsA9TSvEljJhQ
	Cg/8KBtOdXArRI2Qg8WDEsPDxnuhzhpKu
X-Gm-Gg: ASbGncsQRbXDOEqwZAZch+/JwLgwNhHuxoPP5oiiW7gYT0K26fMcx6fbvHN1tGBiqLB
	ZJ7OBg+UkGdNWXTpXat84ZoNraOmwIrEJQu42kNJXOwi+CoQSnkbkc64b7NYm0WvCz7oAz3it7Y
	Ev2OTfpEVUdwdfi6JF0s7uMbL/1w==
X-Google-Smtp-Source: AGHT+IH/IskHp7YC7gVWKUxP0IsaQXx7RqQRNzF+FQ6uMGKQ+0edyLEcgjqrXqea11GMEyeQWHnGXxpSERbRrI9noQA=
X-Received: by 2002:a05:6902:230f:b0:e5b:16b3:ecfb with SMTP id
 3f1490d57ef6-e60b2f2dbaamr13400917276.35.1741017820048; Mon, 03 Mar 2025
 08:03:40 -0800 (PST)
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
x-ms-reactions: disallow
MIME-Version: 1.0
References: <E0EFE00D-07E7-47A1-89C2-865E90812E7B@daniil.it> <1741011949553.2796973485.548949007@gmail.com>
In-Reply-To: <1741011949553.2796973485.548949007@gmail.com>
Date: Mon, 3 Mar 2025 17:03:25 +0100
X-Gm-Features: AQ5f1JrLkX--dBxYkmL4U8iRj6coZFyGX0OW7rtGVw_JzWZHjpre5QoCoQFRZ7s
Message-ID: <CAOWwgpkOCKuDPsid=kr6arcUFw7F_+KD_X=qAX_aKn9G94CHKg@mail.gmail.com>
Subject: Re: [PHP-DEV] PHP True Async RFC
To: Edmond Dantes <edmond.ht@gmail.com>
Cc: Daniil Gentili <daniil@daniil.it>, internals@lists.php.net
Content-Type: multipart/alternative; boundary="000000000000b638a7062f724c26"
From: nicolas.grekas+php@gmail.com (Nicolas Grekas)

--000000000000b638a7062f724c26
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Edmond,

Thanks for sharing the huge amount of work that went into this!

I would really prefer it to be always enabled, no fallback at all, because
> as I said, it will make absolutely no difference to legacy, non-async
> projects that do not use fibers, but it will avoid a split ecosystem
> scenario.
>
>
> I'm not arguing at all that avoiding the call to this function is a good
> solution. I=E2=80=99m on your side. The only question is *how* to achieve=
 this
> technically.
>
> Could you describe an example of *"ecosystem split"* in the context of
> this function? What exactly is the danger?
>

Not sure it's an answer to this question but in Symfony's HttpClient, we
have an amphp-based implementation that's working both outside and inside
an event loop:
- inside means amphp's scheduler already started, and then each request is
scheduled thanks to amphp's http client
- outside means Symfony's code is going to trigger amphp's event loop
internally.

The target DX is that when outside any event loop, we're still able to
leverage fibers to provide concurrency, for requests only, and when inside
an event loop, requests run concurrently to any other things that the loop
monitors.

Is that something that could be achieved with your proposal?
If not, maybe that's the split we're wondering about?

Nicolas

--000000000000b638a7062f724c26
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Edmond,</div><div><br></div>Thanks for sharing the=
 huge amount of=C2=A0work that went=C2=A0into this!<div><br><div><div class=
=3D"gmail_quote gmail_quote_container"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex"><blockquote style=3D"margin:0px 0px 0.8ex;border-left:2px sol=
id rgb(0,0,255);padding-left:1ex"><div>I would really prefer it to be alway=
s enabled, no fallback at all, because as I said, it will make absolutely n=
o difference to legacy, non-async projects that do not use fibers, but it w=
ill avoid a split ecosystem scenario.</div></blockquote><div><br></div><div=
><p>I&#39;m not arguing at all that avoiding the call to this function is a=
 good solution. I=E2=80=99m on your side. The only question is <strong>how<=
/strong> to achieve this technically.</p><p>Could you describe an example o=
f <strong>&quot;ecosystem split&quot;</strong> in the context of this funct=
ion? What exactly is the danger?</p></div></blockquote><div><br></div><div>=
Not sure it&#39;s an answer to this=C2=A0question but in Symfony&#39;s Http=
Client, we have an amphp-based implementation that&#39;s working both outsi=
de and inside an event loop:</div><div>- inside means amphp&#39;s scheduler=
 already started, and then each request is scheduled thanks to amphp&#39;s=
=C2=A0http client</div><div>- outside means Symfony&#39;s code is going to =
trigger amphp&#39;s=C2=A0event loop internally.</div><div><br></div><div>Th=
e target DX is that when outside any event loop, we&#39;re still able to le=
verage fibers to provide concurrency, for requests only, and when inside an=
 event loop, requests run concurrently to any other things that the loop mo=
nitors.</div><div><br></div><div>Is that something that could be achieved w=
ith your proposal?</div><div>If not, maybe that&#39;s the split we&#39;re w=
ondering about?</div><div><br></div><div>Nicolas</div></div></div></div></d=
iv>

--000000000000b638a7062f724c26--