Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125891 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 BAC981A00BD for ; Fri, 1 Nov 2024 20:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730491829; bh=gAgRgzJfU9n2Kw68qBw969nyAwQmZasTxlEpVUPbZvg=; h=References:In-Reply-To:Reply-To:From:Date:Subject:To:From; b=gtfTKgPWzjSfMgH8ZSUBQj8d7a6Wvab8tiITu+RBJ7C0Pe8DOuVgVPQ4Mi2O/uz9N O5dexrN0zRRthtMRvrLDCNwnKm1M/oo6ODFOyvNbGIbM5Q07dgk1pKYs2k+kg8rBjL OOaWWJCKhRMF20WICl9dmldZ8fsWgA/54h29dzq2tvXtQFkZoSZwA3kkUZA39SAPjH DfEjiJD+3rploPfc2JAOkFQobLZ406RHbELcslsm1v/dtQRTRLSyM44nK8weqbt6s+ IW0pDrfvdH2oqrVrQLme64QFyJWZUq2BeCyCpawahWM2pKcyuHuHqICmOe8FwPwMbM Fk0plXdMtj2/A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7178918006A for ; Fri, 1 Nov 2024 20:10:28 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLYTO,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-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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, 1 Nov 2024 20:10:27 +0000 (UTC) Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3a6bd37f424so954025ab.2 for ; Fri, 01 Nov 2024 13:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730491676; x=1731096476; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gAgRgzJfU9n2Kw68qBw969nyAwQmZasTxlEpVUPbZvg=; b=U2nasF/E0QcYt391ZhRq7OLPMxyk7jYQ4RjVBuehTOk0YfSkVpBU9GNwZp20ALZCUV uwFjeos5FkkvUhL/YJT+1SxfLVp0Y92DV9yG33tK/T3MZaJcQXTKT/tpNf4i2G5ZHia4 h8CJN7Y9gGUmP1Uy0CdLUnQvi8KqwIYVLk2xTe0pnrTf1GuviCrvlcA84COBwwxEt6Hw mv78Rbas+e3F0PsiiQnNefBXsQh7DJ2V28d4MdhaMaxGSAJYoHwhh3uFIgXxDLv9U8S9 bz0Yk1m/h3QVUqNY9pHPsyOSIni4CgukEVRjmiNleFEfEHQ3KGG7WTo2JLL4hVJIinf8 dA8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730491676; x=1731096476; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gAgRgzJfU9n2Kw68qBw969nyAwQmZasTxlEpVUPbZvg=; b=PSwOEB+lkbfLTE0Fif2g+TWatXw7V9mtBy9cz2S7/VwPgphg9ppDfbVMqroSwCfYn/ DpGIz+OkhsCXIwIKqxWGPrsiu6dEm6aH1THssHe1V3X+9pvXkiTZpwEm7UUuzo1Jdr1B KrvpLYY5j+eLmX6Z2+mAKony/XdzYnD6XxHJkrYsFz7Y/kiFxsFBET2H/Xymj0VT4xLJ z5vOTGhGyi4Rf4Fmh93/AxDLBckpqTjBS+3RzvouWiffaC5h5/OV326a18J51nmkHduD LaJeCncLAZobA7IRMnAM5dSo4hfVuSNAaZ0FaalTYcVak+EoFcVHutuhZSY3zHOvOgma Fteg== X-Gm-Message-State: AOJu0YyHYOVdhnMegor4K52iRefGSLZbe8j9XRnw1E4tx60y31435/e8 M7DGdRZOAZ9Et9UiOtt52AT/7Srod3uBVGImaokL0jUiI2DAApEWKMlo4yFZKNztOTT1YnvZMdt SDVgqJzjVEpFWvJQrvIKOClE3Ps+qZftw X-Google-Smtp-Source: AGHT+IEwAqJ0DZdS6MriPJR0cww1jN3ZbrHkmeJEZIwyo1XZtYzFRbEEVgFeL4bgx9b0g3A4fa9rrN9LTKbGlA4rRZ4= X-Received: by 2002:a05:6e02:b29:b0:3a4:e823:1cd9 with SMTP id e9e14a558f8ab-3a5e2514814mr122244725ab.16.1730491676040; Fri, 01 Nov 2024 13:07:56 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Reply-To: erictnorris@gmail.com Date: Fri, 1 Nov 2024 16:07:39 -0400 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Persistent CurlShareHandle objects To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: eric.t.norris@gmail.com (Eric Norris) On Fri, Nov 1, 2024 at 2:59=E2=80=AFPM Gina P. Banyard = wrote: > > On Wednesday, 9 October 2024 at 21:16, Eric Norris wrote: > > > Hello all, > > > > After receiving some feedback about > > https://github.com/php/php-src/pull/15603, I'm formally proposing an > > RFC to add persistent curl share handles here: > > https://wiki.php.net/rfc/curl_share_persistence > > > > Thanks to those who have provided feedback so far! Of note: the > > implementation introduces a global variable to the curl extension via > > ZEND_BEGIN_MODULE_GLOBALS; this appears preferred over > > EG(persistent_list). Should the implementation stick with the module > > global, or should it go back to EG(persistent_list) until we've > > created a formal non-resource API (in another RFC)? > > > > I'd like to keep the future of persistent resources out of scope for > > the decision on whether to add curl share handle persistence to PHP, > > but it is worth deciding what form the persistence takes for now. > > I have voted against the RFC as it lacks details and there seems to have = been no analysis on what sort of issues this can cause. I appreciate your feedback, but from my perspective there aren't really any major issues that this can cause. We already support curl share handles via curl_share_init, and adding persistence doesn't fundamentally change the issues you may have with reusing a curl handle. Tim pointed out that libraries may use this functionality - and I hope they do, as it can improve performance - in a way that is dangerous for users, but I frankly don't see that as likely. HTTP request libraries will likely be interested in the connection sharing aspect of this, not the cookie jar. If they were to enable cookie sharing, they would need to do that in a way that was safe for users, much like they would for any other setting in PHP. It's worth noting that setting CURLOPT_COOKIEJAR is already possible with PHP today. > This has been pointed out by Tim already, and this should have been caugh= t earlier, but I don't know if it just me, but it seems your email kinda we= nt into some void and got unnoticed. Thank you for taking the time to respond at all, late or not. > Persistent handlers don't really fit PHP's model, and are practically unt= estable from a PHPT test perspective as far as I know (at least I have neve= r seen any proper tests for the existing ones, but I am happy to be correct= ed). Persistence is important to successfully scaling Etsy's monolithic PHP application. As I mentioned in a response to Tim, we make use of persistence for things like memcached connections in order to reduce end-user latency, and we'd like to take that further by persisting the connections of downstream curl requests we make. This is not just an Etsy-specific issue; https://blog.jetbrains.com/phpstorm/2024/10/php-annotated-october-2024/#%F0= %9F%93%8A-rfc-add-persistent-curl-share-handles notes that other large-scale PHP users are interested in persistent HTTP(S) connections. I'd implore you to consider that this would have a real-world impact on companies that make use of ext/curl in PHP, without needing to use alternative runtimes or external software. > As such I am very reluctant to adding more of these things to the languag= e, especially when this seems to just have been hacked together quickly, we= still have at least 7 months before feature freeze and I would prefer to a= ctually be done properly. I'd like to note that I don't feel like this was "hacked together quickly". I take pride in writing high-quality code, and I've attempted to request feedback multiple times in both the PR and in the internals mailing list. I plan on implementing tests as well as I possibly can assuming the RFC passes, but I did not want to invest in doing so unless it did pass. If there are any quality issues you see in the PR, please feel free to point them out! @kocksismate already noted a few changes that I planned on making. > Especially that it is always easier to add new features than to deprecate= and remove bad ones (which is kinda backwards but not relevant to this dis= cussion). If we truly feel that persistence is wrong for PHP, we would need to deprecate and remove things like persistent PDO connections; I would expect that would be a perfectly fine time to also remove support for persistent curl share handles, if they existed. Thanks, Eric