Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waBgy-001ajD-1H for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2026 12:17:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1waBgw-00BEeB-1O for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2026 12:17:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waBgv-00BEe3-2q for pgsql-hackers@lists.postgresql.org; Thu, 18 Jun 2026 12:17:54 +0000 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1waBgt-00000000y5i-2JJd for pgsql-hackers@postgresql.org; Thu, 18 Jun 2026 12:17:52 +0000 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-91587626ae1so104651285a.3 for ; Thu, 18 Jun 2026 05:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20251104.gappssmtp.com; s=20251104; t=1781785069; x=1782389869; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=BNgFXzDmfyfo+R131wm//Ud/Dmija6p3vV7UOuLk/yU=; b=lL3D9p1USAJC3zTw0KvhF6G/Be2QoFqv2DRijpq9CxUyg5bToAKXRG3NXqmmbmQP3E p4VdcN8+jMjnb5s9lPlNnX6SWrD5E9Guf7SHsYKnBoC4f49D71r5JpNbH/drzchbvkbL PrrxZvo+qbxgpzyWnz7VV8Sj00YaZdMyC2itJkdpQ48gT8eLifVoEdXne1td79QoSxeu +uOXW6JuJTZTMPZssp6TyegIQVf1lfqg2W4nbEoqzP5Lto0UE4vQSoQZQ9EONwhGmPmD utIhY7C1igMV1ritoE7iBEkZZTpq8KE/dyqaSLFPtiCc3W7S/CVaNQ31tD9xoRiRTnms KDdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781785069; x=1782389869; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BNgFXzDmfyfo+R131wm//Ud/Dmija6p3vV7UOuLk/yU=; b=OEhp3janq3elKXjg8ok0ipopEsAi4YA5N/Ot0DXBVGhuuMIfh4SFW4sV6Zrnc+hjkk KDmmZUFWnGi7gQh9u6ntVb3vh6VJPb1MLIo5XdGjR5YIKoV0bnEH8i7vINOcCBnugXZT 6H+NSS3zz6WhFKTteV6p7bOLWjaDJCtVdlQ8jo4dTWzRtyTnCVeETa2jwO04pWO16REI ZnAAgIdY9Yu4KZtW970JqSYI4+JgWXZgyu+updBB88fhROYbBP90AzVjiNmP4+pS2EOH j8WZH1Zix6oZ2P2VNho1hyMPtmu1awlx7HTpVmsvdzY4SJsTEBEnhq+/mOy03NGbXboJ vUzA== X-Gm-Message-State: AOJu0YzQgj51grwhGUHm89VFPpPhupSv2KIidkY5ZQ7l3J1RqZEKSdzN qkCp8/OxrWvEDohZAkLe11d1g/ADMvO1Jjxmolo+im9VbjS9/tNmnYQIES3JoMMmg8w= X-Gm-Gg: AfdE7cmtYIHZrbyUYo/RDdtr8chprpsEL0JR0k01EyQcpv12XrJfHOi5QkG9QzU1MM8 4N9xALrHhdd16tWmnrC7GLM4AreYaEj6qzuLBiD0vbj9pKjnrriCrIVUfc8s4bYWZRjdeUI97aA QZRwp2CaVjpmTRncd01CUHVIQDdfaYyDnq8rWyGVLlgEdP3/QtXtVF9R44zRYEZnCekrgiIYKsY T/1d86fSy2b3IQc7IizPq7DHea+swcV3ni6TCoSrG0iRrN56HFZc51HIz9IM7wV5QGnf+VR0ce1 rHkCTxCl5dZbWxi75c5z/FkysYVrNSzTbwoomWoY0KhINHltKybDwjr/xf29Ws7825bk5xnvk3e HhHSXRkZQXpbVWPpwUmhcSpPJfl1vlVM+9SkXfmPlZsJKl5pSwabNUSKx0k2BlCKBEjN/wJg7gE 8EhksoXGMcfvmV379eb4HxjoLdkliXyLJU3zL+rBTYGhJO6Szg9eEZTZlrl6yG X-Received: by 2002:a05:620a:25ce:b0:915:931e:5e8c with SMTP id af79cd13be357-91d8add3c02mr1382763985a.7.1781785069311; Thu, 18 Jun 2026 05:17:49 -0700 (PDT) Received: from ?IPV6:2605:a601:a6b0:500:ccb8:56eb:bfc6:86b5? ([2605:a601:a6b0:500:ccb8:56eb:bfc6:86b5]) by smtp.googlemail.com with ESMTPSA id af79cd13be357-91619f05fe7sm2225424385a.12.2026.06.18.05.17.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2026 05:17:48 -0700 (PDT) Message-ID: <6d18ff30-00bf-42a4-9cad-25be682a43db@dunslane.net> Date: Thu, 18 Jun 2026 08:17:47 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BackgroundPsql swallowing errors on windows From: Andrew Dunstan To: Andres Freund Cc: pgsql-hackers@postgresql.org, Noah Misch References: <762648ad-99b5-4871-beaa-ca275e46ef6e@dunslane.net> <5dgt6vir7n664qruw3ndywpmfxsmfuu4oeh43syocgo3g6v72n@hjxahrqk4w7t> <1779b4d6-768f-4edb-8cd6-62706d321f32@dunslane.net> <1880b789-cb54-4162-ae19-9eb29fabc8da@dunslane.net> <3510c901-b760-4534-9371-8a921d955549@dunslane.net> <506de8d3-e2b1-4929-88d8-96253d5e4121@dunslane.net> <455b56c8-436d-45fe-b70b-314e11ca65fc@dunslane.net> Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAlwQTAQgAQQIbAwIX gAIZAQULCQgHAwUVCgkICwUWAgMBAAIeBRYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNGd BQkdEO8nAAoJEJn6f8tZ/DuBq74H/jkTR4Zi3stbw+xC7v2u3QozssK7MYPL2AsVfh7OealS h182fiWXpfvmmAB7WUHbhk9GC2RAOnHI/2d2jgKaMLAHsGYOT0YopTVIwRY43fCw/mK67yxc wmDcX+zyKfLaivNbf5A7QPLNwda98bEAMSJ8Sn652Uc6cA8t3uKGsVzbRBQOoYzjgvBCfSrE 9ql3PDNg0l4BfAqabd2f70ZUm9VAMEPrgv/v2xI7M2XiL4g5BVmqLCOwxLM8RMCotCuoweUr VO43DeBCIDwLxotMJKvGWDjBzQYlU1NPUAtNcz/gN9ITUe1VUGjyvGj4u1lxBOcQQUw7l1+T 5moZ4iZxXzvOwE0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oKWaqf+wmW4tpDe/VV cxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7llV0xSSoFiieQBsr GvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8BoVrRFcdzlIY/NFN hFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C4R+M6w7o2PLGOjdZ +kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaYL++LAEOqrlvm2Tvq QqZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-06-15 Mo 9:43 AM, Andrew Dunstan wrote: > > On 2026-06-12 Fr 6:39 PM, Andrew Dunstan wrote: >> >> On 2026-06-10 We 4:23 PM, Andrew Dunstan wrote: >>> >>> On 2026-06-03 We 5:23 PM, Andrew Dunstan wrote: >>>> >>>> On 2026-06-02 Tu 3:03 PM, Andrew Dunstan wrote: >>>>> >>>>> On 2026-02-18 We 2:41 PM, Andrew Dunstan wrote: >>>>>> >>>>>> On 2026-02-17 Tu 4:56 PM, Andres Freund wrote: >>>>>>> Hi, >>>>>>> >>>>>>> On 2026-02-17 16:31:02 -0500, Andrew Dunstan wrote: >>>>>>>> On 2026-02-16 Mo 7:17 PM, Andres Freund wrote: >>>>>>>>> I briefly tried this out. The overall resource usage of the >>>>>>>>> test is noticeably >>>>>>>>> reduced - and that's on linux with fast fork, so it should be >>>>>>>>> considerably >>>>>>>>> better on windows.  However, the tests take a lot longer than >>>>>>>>> before, I think >>>>>>>>> mostly due to polling for results rather than waiting for them >>>>>>>>> to be ready >>>>>>>>> using PQsocketPoll() or such. >>>>>>>>> >>>>>>>>> E.g. bloom/001_wal takes about 15s on HEAD for me, but 138s >>>>>>>>> with the patch. I >>>>>>>>> think that's just due to the various usleep(100_000); >>>>>>>>> >>>>>>>>> >>>>>>>>> FWIW, oauth_validator/001_server fails with the patch at the >>>>>>>>> moment. >>>>>>>>> >>>>>>>> Try this version. On my machine it's now a few percent faster. >>>>>>>> I fixed the >>>>>>>> polling. I also added pipeline support for large sets of >>>>>>>> commands, to >>>>>>>> minimize roundtrips. >>>>>>> Nice!  Will try it out. >>>>>>> >>>>>>> >>>>>>> Have you tried it on windows already? That's where we pay by far >>>>>>> the biggest >>>>>>> price due to all the unnecessary process creations... >>>>>>> >>>>>>> It looks like strawberry perl has FFI::Platypus, but not >>>>>>> FFI::C.  There is >>>>>>> perl/vendor/lib/FFI/Platypus/Lang/C.pm, but that just seems like >>>>>>> it's >>>>>>> documentation.  There is however FFI::Platypus::Record, which >>>>>>> maybe could >>>>>>> suffice? >>>>>>> >>>>>>> Do we actually need FFI::C, or can we work around not having it? >>>>>>> Looks like >>>>>>> it's just used for notify related stuff. >>>>>>> >>>>>>> It looks like mingw doesn't have packages for FFI::Platypus, but >>>>>>> it'll >>>>>>> probably be a lot easier to build that than when using msvc. >>>>>>> >>>>>>> >>>>>> >>>>>> I replaced the use of FFI::C with FFI::Platypus::Record. That >>>>>> comes for free with FFI::Platypus, so there would be no extra >>>>>> dependency. It means a little extra housekeeping so we don't lose >>>>>> track of the pointer for later use with PQfreemem, but it's not >>>>>> too bad. >>>>>> >>>>>> I have tried it out with Windows, seemed to work OK although the >>>>>> xid_wraparound tests 2 and 3 timed out. >>>>>> >>>>>> Latest is attached. >>>>>> >>>>>> >>>>>> >>>>> >>>>> Here is v12. I removed the XS variant in this version, which makes >>>>> things simpler. We can restore it if necessary. >>>>> >>>>> Patch 1 adds the new framework >>>>> >>>>> Patch 2 adapts Cluster.pm to it, as well as handling some >>>>> instability at global destruction time that was exacerbated by >>>>> using FFI::Platypus. >>>>> >>>>> Patch 3 makes improvements in the individual TAP tests using the >>>>> framework, including removing every one of the calls to >>>>> background_psql(). >>>>> >>>>> >>>>> I'm going to add this to the CF and will start testing (again) on >>>>> Windows. >>>>> >>>>> >>>>> >>>> >>>> v13 attached now passes all tests on my Windows machine. >>>> >>>> >>>> >>> >>> rebased, including porting a new use of background_psql. >>> >>> >>> >> >> v15 including a check for FFI::Platypus at setup time, and CI >> modifications to allow tests to pass. >> >> >> > > > v16 follows several rounds of review, and tightens up a lot of things, > so now errors don't silently disappear, or failing tests hang where > previously they would time out. There has also been some code cleanup, > removal of magic numbers (you can now check for CONNECTION_OK for > example), removal of some dead code. > In view of discussions on https://www.postgresql.org/message-id/cdaaf722-4529-435b-9340-cedf1a3a277f%40dunslane.net I have withdrawn the CF item. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com