Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129113 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 lists.php.net (Postfix) with ESMTPS id 293361A00BC for ; Thu, 6 Nov 2025 09:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762422929; bh=AvPFgkofZSm0cQ7AIhT6N3HaZYwM6vtfDmVWzpEyDDc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Txz7ENIo3ZHNTZ33+yTtqtag7Ancri179B1tJ9ms8PqNmpTGYdlV5Qvobeda8QWVc bR0VFqxfrnjbjQWWc/2TA5yKD2iFVCVbLN8sc/Xgq+4viOTEyBxyeUQlZF/6HamVo4 0owLZEhQyVdRKcvTz1Z3njuXjlA9DA41zcbyxZLUEgEsuWxaeosYp9m107T0tjFwmC 0SwwazFpayvHftEBvKQEfuPkYlBMHCtEql956rL3+ubG3sMuxxvjllPTEhy2fs4yiE GD1HWIO9XMDOr7pTDCblR5jWysNhmfSFynwBmQyqY1IuNCPxhhSqlqxoxbq0CnG73v 59K9i2OruOYsg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 28A9818006D for ; Thu, 6 Nov 2025 09:55:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_50,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 ; Thu, 6 Nov 2025 09:55:28 +0000 (UTC) Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-7c6e815310aso158773a34.0 for ; Thu, 06 Nov 2025 01:55:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762422923; x=1763027723; 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=AvPFgkofZSm0cQ7AIhT6N3HaZYwM6vtfDmVWzpEyDDc=; b=scTKRGqlMu6xPQb1AwLY6LUrtnwIt8qluAQDVvFPcPSFlasiSq5jZlMr/zZG8WKGFG BRlPG9YLSNrLWC8cVmd0wSNqZ6LmZqex4IBzAedFxPsPx88WALPpRuMy1PMAjLR3iAf2 uI/hGcrx42UKJcumKaoiKDEULwoNOt+N7BuXk5Gp6F2webE5IoxdJyeVfP7zrgGXfGwq NgYaHBOVrCXpIzVcqK3PtJQqpnRgeUbwc9XzlO8p/MydGrLBKJ6+JCdovyVWbkNuNnTb 97ZaO6SkWPQVVxkeCkxRKUX03IgZ1345IYZpWSYAb7EYcAbFT8BIMNsPyYNDh9T3YwAV qezw== X-Forwarded-Encrypted: i=1; AJvYcCV4omVfH/UXpTl8X6prdOtlmNJmxMcUrwd2pzBOGKRviuWqAiGkaY2nOw9MEJLqojTq3sP1hDE3Ct8=@lists.php.net X-Gm-Message-State: AOJu0YyTi5llGo+s4ng27T4PDX7U69tyip+En7y+zwno8HqdWb3Vr+Y/ VALx67CpfEaMvIyfv/AMQNXV4tCqBHfo+ARR236EaoxWuTwijcb3BsWKOCbF1lANvtoEF/bqswY ryQc4tV/AvL6eauMXGiDIrHCM9DeuLIzECQ== X-Gm-Gg: ASbGnctVwywhxhHvssg/DC4m/NvJOWzdtE7B5RgaU6CMu3oDscAO1ameoWMkwbK68UZ kIi5Ilqc1H4GcuxbD3WNw1i6XOYfUfMib5DCUoRG6n/3Rxsa+q1G0xWLbVQ1y6WIxgmHlJU+2Qi oT1nZq+Nq0tHBKwjlRHZuv4y9gSDu/ktS1eQsKrDNOst7Lj1pIJ8Sw14bWz6pmN3b2hxv6ZqDer AjSGOTQwQKxXbdROaibC6Yp9E12MGLUnPaI/eKedU63NiGltnhFMZi5Qjyv3tH0K3Oefg4= X-Google-Smtp-Source: AGHT+IH+J+xXpzSho3KKPB0NZHsval3K5lFEoE4+i01DgST0jGm3YX9X05HFCE0S/rR/fj2cajmoPvrm8Mz5xAUdkr0= X-Received: by 2002:a05:6808:4441:b0:44f:dc50:29c5 with SMTP id 5614622812f47-44fed087a72mr3606107b6e.0.1762422923031; Thu, 06 Nov 2025 01:55:23 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <0f38bc1a-ba13-43e1-9ee1-70085e75faa6@app.fastmail.com> In-Reply-To: Date: Thu, 6 Nov 2025 10:55:11 +0100 X-Gm-Features: AWmQ_bnVOXm0xHZwHBDg5jEVy8oiAj-Y6k261A13NYOETe_U_GgUcqftW9RTBBE Message-ID: Subject: Re: Re: [PHP-DEV] [RFC] Polling API To: =?UTF-8?B?6Z+p5aSp5bOw?= Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="0000000000004577e20642ea1077" From: bukka@php.net (Jakub Zelenka) --0000000000004577e20642ea1077 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, First of all, please don't top post. On Thu, Nov 6, 2025 at 3:47=E2=80=AFAM =E9=9F=A9=E5=A4=A9=E5=B3=B0 wrote: > I don't know what changes this proposal could bring to PHP if the aim is > simply to introduce event loop mechanisms like epoll or kqueue. > The primary reason for this is to have an internal API that we can use internally. The primary motivation was to actually have a better mechanism for handling signals that can be safely used in ZTS. This is one of the main blocker for introducing coroutine based TSRM mode that could be used by FrankenPHP to use goroutines instead of threads. There was also related timer issue on MacOS and at that time Arnaud came up with kqueue only PoC implentation but we decided that it would be great to have something more generic but we wanted something really minimal without a need for the whole event loop abstraction like libuv or libevent (libev is dead AFAIC) offers. After that I also had few other use cases in FPM as I wanted a bit more generic event handling than what is currently there so I can use it in child before accept. Note that we have got already its own event implementation in FPM so this is more advancement in that area. So when we have an internal API which we plan anyway, then I thought it could be nice to also expose it to user space so project like AMPHP can use it and effectively drop all other backends. In addition it didn't look good that the only current polling mechanism for streams is based on select so this is also effectively replacement for stream_select. Again not all users using it need the full even loop. > Why not make ext-uv (libuv) or ext-event (libev) built-in PHP extensions, > just like ext-curl, ext-xml, or ext-bcmath? > Those are all optional extensions because they depend on external library. Currently the only way how we could make it always available is to bundle those libraries but especially libuv is quite bloated and adds unnecessary overhead for our other use cases. We actually discussed it internally if we should use or bundled libevent but the agreement between couple of core devs was to create a simple polling API instead so here we are. I will update the RFC and add more explanation there as this was also requested by Larry and I can see that the motivation and primary use cases for this are not exactly clear. Thanks for the feedback. Kind regards, Jakub --0000000000004577e20642ea1077 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

First of all, please don= 't top post.

=
On Thu, Nov 6, 2025 at 3:47=E2=80=AFA= M =E9=9F=A9=E5=A4=A9=E5=B3=B0 <rango= @swoole.com> wrote:
I don't know what changes this proposal could bring to PHP= if the aim is simply to introduce event loop mechanisms like epoll or kque= ue.=C2=A0

The primary rea= son for this is to have an internal API that we can use internally. The pri= mary motivation was to actually have a better mechanism for handling signal= s that can be safely used in ZTS. This is one of the main blocker for intro= ducing coroutine based TSRM mode that could be used by FrankenPHP to use go= routines instead of threads. There was also related timer issue on MacOS an= d at that time Arnaud came up with kqueue only PoC implentation but we deci= ded that it would be great to have something more generic but we wanted som= ething really minimal without a need for the whole event loop abstraction l= ike libuv or libevent (libev is dead AFAIC) offers. After that I also had f= ew other use cases in FPM as I wanted a bit more generic event handling tha= n what is currently there so I can use it in child before accept. Note that= we have got already its own event implementation in FPM so this is more ad= vancement in that area.

So when we have an interna= l API which we plan anyway, then I thought it could be nice to also expose = it to user space so project like AMPHP can use it and effectively drop all = other backends. In addition it didn't look good that the only current p= olling mechanism for streams is based on select so this is also effectively= replacement for stream_select. Again not all users using it need the full = even loop.
=C2=A0
=
Why not make ext-uv (libuv) or ext-event (libev) built-in PHP ext= ensions, just like ext-curl, ext-xml, or ext-bcmath?=C2=A0

Those are all optional extensions because= they depend on external library. Currently the only way how we could make = it always available is to bundle those libraries but especially libuv is qu= ite bloated and adds unnecessary overhead for our other use cases. We actua= lly discussed it internally if we should use or bundled libevent but the ag= reement between couple of core devs was to create a simple polling API inst= ead so here we are.

I will update the RFC and add = more explanation there as this was also requested by Larry and I can see th= at the motivation and primary use cases for this are not exactly clear.

Thanks for the feedback.

Kin= d regards,

Jakub

=C2=A0
--0000000000004577e20642ea1077--