Re: [RFC] [Discussion] Persistent CurlShareHandle objects

From: Date: Mon, 04 Nov 2024 11:45:44 +0000
Subject: Re: [RFC] [Discussion] Persistent CurlShareHandle objects
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-125897@lists.php.net to get a copy of this message
Hi Am 2024-11-01 21:07, schrieb Eric Norris:
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
Yes, it does. See the reply that I just sent in the voting thread.
Persistent handlers don't really fit PHP's model, and are practically untestable from a PHPT test perspective as far as I know (at least I have never seen any proper tests for the existing ones, but I am happy to be corrected).
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.
As far as I know the memcache protocol is stateless - except possibly for authentication. In that case every connection would be equal / immutable, making it safe to reuse. MySQL - as an example - is different, because changing any of the connection-related variables, e.g. with SET sql_mode='foo' might ruin your day for follow-up connections.
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.
I believe that *stateful* persistence is wrong and will lead to hard-to-debug situations sooner or later, yes. Best regards Tim Düsterhus

« previous php.internals (#125897) next »