From owner-freebsd-stable@FreeBSD.ORG Mon Apr 3 18:22:25 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C28D516A420 for ; Mon, 3 Apr 2006 18:22:25 +0000 (UTC) (envelope-from vivek@khera.org) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by mx1.FreeBSD.org (Postfix) with ESMTP id 645C443D48 for ; Mon, 3 Apr 2006 18:22:25 +0000 (GMT) (envelope-from vivek@khera.org) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 5BF5CB816; Mon, 3 Apr 2006 14:22:24 -0400 (EDT) In-Reply-To: <14654.1144082224@sss.pgh.pa.us> References: <20060402163504.T947@ganymede.hub.org> <25422.1144016604@sss.pgh.pa.us> <25526.1144017388@sss.pgh.pa.us> <20060402213921.V947@ganymede.hub.org> <26524.1144026385@sss.pgh.pa.us> <20060402222843.X947@ganymede.hub.org> <26796.1144028094@sss.pgh.pa.us> <20060402225204.U947@ganymede.hub.org> <26985.1144029657@sss.pgh.pa.us> <20060402231232.C947@ganymede.hub.org> <27148.1144030940@sss.pgh.pa.us> <20060402232832.M947@ganymede.hub.org> <20060402234459.Y947@ganymede.hub.org> <27417.1144033691@sss.pgh.pa.us> <20060403164139.D36756@fledge.watson.org> <14654.1144082224@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Date: Mon, 3 Apr 2006 14:22:23 -0400 To: freebsd-stable X-Mailer: Apple Mail (2.746.3) Cc: pgsql-hackers@postgresql.org Subject: Re: [HACKERS] semaphore usage "port based"? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2006 18:22:25 -0000 On Apr 3, 2006, at 12:37 PM, Tom Lane wrote: > semaphore keys on each cycle of life, so you'd have to get fooled by > chance coincidence of existing PIDs every time over many cycles to > have a severe resource-leakage problem. (BTW, Marc, that's the reason > for *not* randomizing the key selection as you suggested.) Seems to me the way around this with minimal fuss is to add a flag to postgres to have it start at different points in the ID sequence. So pg#1 would start at first position, pg#2 second ID position, etc. then just hard-code an "instance ID" into the startup script for each pg. No randomization make it easier to debug, and unique IDs make it avoid clashes under normal cases.