Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128749 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 B0E011A00BC for ; Tue, 30 Sep 2025 21:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1759266388; bh=L3B10VlOmcsmYhMhVMXStFT8AsI1pI6TFES2HfWIxbQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=g/TTymRWcWCaX7uUUniTsRhvHr2HZdspXu/ns1xSwIU5+dtFwl7q3nibJsIDMqYWy eA9sm/ciZeAA6UOZWT0HWNxQ0nnE+j50lP0mrbYwNBM1qc4xX307BHZjGsB1i4aAFf H/tT6Tx8kW+4M/cJfdRpxCJdbFmi1fDrB+WS63mmjMcTgHxo6Ba32D5TMED/h+K6Pe wf9ngA4UgA7eUvqiIoGOk9neqicOiP2bM6nCUr0ZV0NokzITxKBX1f+Dadk3LQTj6u AGY13PK07oVBx/IBjl8ReAqJL5WptRHCCEqhjppZiB24ioP1Svq0+S8y4KreMimjka SvzqITUZpmOpQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 44BD31801EE for ; Tue, 30 Sep 2025 21:06:27 +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=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 ; Tue, 30 Sep 2025 21:06:26 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id AC2577A00F8 for ; Tue, 30 Sep 2025 17:07:45 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Tue, 30 Sep 2025 17:07:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1759266465; x=1759352865; bh=d0As4WsdvE1Lh5jWoNZxh nzXMRXdzP/OToxr8R2RYyI=; b=twY/xs2jpX4S3thDLgZvFJcJ3Cls4VNo+gvJH PObHDBMOr6yOmREAMLIquxLsj0lo5rV15pXpnSlLxZbKctPdDy4l5Yn4iMdQm3XW yVyv8kdjespxTPLKjA06dmI0+52OxcmA1VL12YCorEHXB2vUAPxYHbGhSo1Fq8qy lDXH2cGxebqBEPeWSIUcxmxcMe1x1j2H+w3fC1VTc+WHOm8G2SWpkoWPkFJAmIO6 Kul/l37tdZZWC8efjadfLSJ0pzbPej/q2LOhb64Jt8YknkM0t6/S20kS/Xrw36cp 9OsG9atwx/SemzeC0VlvOcHxCgNGLu+QN3ww7Sayb34M1f+Ig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1759266465; x=1759352865; bh=d 0As4WsdvE1Lh5jWoNZxhnzXMRXdzP/OToxr8R2RYyI=; b=KtQ+KmUlALlOgnojh vPwsjdvRcYZKXnSb+GPcWViftfZV2pCL7AZ/RAjj2H27AUXPQ793uoAk7tTzaGRv R5yUCqP1JYKe9f/TCjretAMUxONuD8e5eh2v1iTa/I54Z65yRfh+MptRbkXisyDi d1lKH6SH825Oo3oB2oWR+IS4d61sSVqs5JgH1PzgeHbMlf+YkLGg/GKjZV2tHcFe wdWKYyu591qIMZ6LfqwFF0jN79tPKQFlVFV1XmCHtF41T4zY+1Iixh8pnC9U+rzu MUTq5GS6SSxbf70b5HmoCK+Q4j01ao8+pdyyzUlJyjZHl328umXWSk2V7Oz5xXXO vn2ww== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdekudeiudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddtgeetieeugeevhfetheeffeeftedu iedthedtgeejueeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphht thhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhsse hlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 223C4700069; Tue, 30 Sep 2025 17:07:45 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AVtkA8y9rfU3 Date: Tue, 30 Sep 2025 16:07:24 -0500 To: "php internals" Message-ID: In-Reply-To: References: <4ddd9a25-47b8-4a2b-ad93-e93f8f33922b@app.fastmail.com> Subject: Re: [PHP-DEV] [Discuss] Add PDO disconnect() and isConnected() Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Tue, Sep 30, 2025, at 3:08 PM, Claude Pache wrote: >> Le 30 sept. 2025 =C3=A0 17:40, Larry Garfield a =C3=A9crit : >>=20 >>=20 >> What would be valuable is easier RE-connection logic. Either PHP or = MySQL may terminate an idle connection, which is a concern in long-runni= ng processes (Queue workers, ReactPHP, Franken, etc.). Tools like Doctr= ine have built their own refresh logic in, although they're not always c= onsistent with each other or obvious to use. Having some kind of reconn= ection logic built into PDO that "just works" would be very valuable. >>=20 >> What that would look like, I'm not sure. Just spitballing: >>=20 >> // After X seconds, drop and reopen the connection the next time it's= used. >> $pdo->reconnectAfter($seconds); >>=20 >> --Larry Garfield > > Auto-reconnection is dangerous, because database engines are stateful.=20 > For example, disaster will happen if disconnection had occurred in the=20 > middle of a transaction... > > =E2=80=94Claude All the more reason that the logic should be implemented once in PDO and= then shared, rather than everyone having to figure it out in user space= themselves. I'm not suggesting that PDO actively try to disconnect all the time. Bu= t if the connection is "stale," it should be able to restart it without = making the user faff about to do so. (Whether that's via detecting that= it's gone away, a timer, or whatever else, I'm very flexible.) --Larry Garfield