Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j6Ifp-0000YU-2J for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2020 18:41:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6Ifn-00033r-JD for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2020 18:41:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j6Ifl-00033k-Kk for pgsql-hackers@lists.postgresql.org; Mon, 24 Feb 2020 18:41:43 +0000 Received: from [64.147.123.20] (helo=wout4-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6Ifh-0004Ht-6Z for pgsql-hackers@lists.postgresql.org; Mon, 24 Feb 2020 18:41:41 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 5052CD6; Mon, 24 Feb 2020 13:41:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 24 Feb 2020 13:41:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=vGWZ7QNmSYsmjwDNastZ3FKyXKO 4BC4t+QbDd7vGYpE=; b=CFFxMUUurY0bSnZDnuHcY13JhXrLfYCWdBhChuc9vRu 28JhtSOo6QZc325VTpbUBkjKXpvshzzPwwh/6IxQ09LnNP3XZsHU0B7jw1DQQysu oz3QKOLwB/TS+ZGfKF69+ReXdC80kFDk68ionAN7SbgAZOMRtAmko/1XVQ+Kergw lhayLB6iIoZAwq+esBfkcA8MmG0S69aL7E5TlOg1QaXPyawIu134nTJP6WC/Nwup jZdQloSyILU8NETNiA0khD//7sXJAGC6geBICz/6G9ZjDuW19EmPI7i+6I/8kNwv yy+g5xFRmIa2dX8Lv6QadlSwTsKSaOFeqE52uc8FV9w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=vGWZ7Q NmSYsmjwDNastZ3FKyXKO4BC4t+QbDd7vGYpE=; b=y7SWt80mLurk+ObUZEAOVr OnTD8AM5O623gq+oII7MUjvD9b6/O+ysVQdDKjAf+0BO3PvkXQaU7jP5PVsj/gzn QP+oSMPY5d6Hs0FaI49xUx4TmlkW8EWPS6EiQg3XC9zDIKlFEulSDhyapywpg/z9 2rYQwR6/pQWry0ySuVkFjYewmA0RZpBU9GFt9rAknoAJdaXah3NMfTEjoHCdDzts Mo9OEFfsSYMqNypN1YtH0RC96KVFG2A79//IVTwa0UCoTPZqg8FYxaigqmiINWpk HrAd+brU9DDtLt8ejFCXHQScMFmM8G37iappF1JfP4HVSnsbRpsKN7hJF5ocLQFQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrledtgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucfkphepie ejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id C3B2C3280065; Mon, 24 Feb 2020 13:41:22 -0500 (EST) Date: Mon, 24 Feb 2020 10:41:21 -0800 From: Andres Freund To: Mark Dilger Cc: Tom Lane , Thomas Munro , =?utf-8?B?UsOpbWk=?= Zara , Michael Paquier , PostgreSQL Hackers Subject: Re: pgsql: Add kqueue(2) support to the WaitEventSet API. Message-ID: <20200224184121.725gnltgycvnw3xu@alap3.anarazel.de> References: <08364CCB-07F5-423E-8CE0-ABF0195C4CA2@mac.com> <17106.1582224047@sss.pgh.pa.us> <19710.1582227844@sss.pgh.pa.us> <20263.1582228617@sss.pgh.pa.us> <26174.1582236314@sss.pgh.pa.us> <6610.1582242943@sss.pgh.pa.us> <18091.1582259407@sss.pgh.pa.us> <13F92C31-0E60-45C9-9031-3B1ECFDD5261@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13F92C31-0E60-45C9-9031-3B1ECFDD5261@enterprisedb.com> X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.20 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2020-02-24 10:29:51 -0800, Mark Dilger wrote: > > On Feb 20, 2020, at 8:30 PM, Tom Lane wrote: > > > > This idea doesn't fix every possible problem. For instance, if you > > have a plperlu function that wants to open a bunch of files, I don't > > see any easy way to ensure we release VFDs to make that possible. > > But it's sure an improvement on the status quo. > > I understand that you were using plperlu just as an example, but it > got me thinking. Could we ship a wrapper using perl's tie() mechanism > to call a new spi function to report when a file handle is opened and > when it is closed? Most plperlu functions would not participate, > since developers will not necessarily know to use the wrapper, but at > least they could learn about the wrapper and use it as a work-around > if this becomes a problem for them. Perhaps the same spi function > could be used by other procedural languages. While we're thinking a bit outside of the box: We could just dup() a bunch of fds within fd.c to protect fd.c's fd "quota". And then close them when actually needing the fds. Not really suggesting that we go for that, but it does have some appeal. > I can't see this solution working unless the backend can cleanup properly under exceptional conditions, and decrement the counter of used file handles appropriately. But that's the same requirement that postgres_fdw would also have, right? Would the same mechanism work for both? We can just throw an error, and all fdw state should get cleaned up. We can't generally rely on that for plperl, as it IIRC can global state. So I don't think they're in the same boat. Greetings, Andres Freund