X-Original-To: pgsql-ports-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D11049DD745 for ; Fri, 2 Dec 2005 14:29:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64531-09 for ; Fri, 2 Dec 2005 14:29:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 9BB4F9DD76E for ; Fri, 2 Dec 2005 14:29:20 -0400 (AST) Received: from mail.libertyrms.com (vgateway.libertyrms.info [207.219.45.62]) by svr2.postgresql.org (Postfix) with ESMTP id C0335F0B1F for ; Fri, 2 Dec 2005 18:29:20 +0000 (GMT) Received: from dev5.int.libertyrms.com ([10.1.3.42]) by mail.libertyrms.com with esmtp (Exim 4.22) id 1EiFen-00065c-PR; Fri, 02 Dec 2005 13:29:17 -0500 Message-ID: <43909292.4070106@ca.afilias.info> Date: Fri, 02 Dec 2005 13:29:38 -0500 From: Seneca Cunningham User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris Browne Cc: pgsql-ports@postgresql.org Subject: Re: AIX Permission weirdness References: <> <60fyqg9tog.fsf@dba2.int.libertyrms.com> In-Reply-To: <60fyqg9tog.fsf@dba2.int.libertyrms.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-SA-Exim-Mail-From: scunning@ca.afilias.info X-SA-Exim-Scanned: No; SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.312 required=5 tests=[AWL=-0.498, INFO_TLD=0.813, URI_NOVOWEL=0.997] X-Spam-Score: 1.312 X-Spam-Level: * X-Archive-Number: 200512/1 X-Sequence-Number: 2256 Chris Browne wrote: > We recently ran into fairly weird regressions on AIX. Shared > libraries wouldn't load, which assortedly meant that: > - plpgsql couldn't be loaded > - Slony-I stored functions couldn't work > - regression tests wouldn't work > > The typical result: > > -bash-3.00$ /opt/dbs/pgsql748-afilias-AIX53-2005-10-19/bin/createlang plpgsql template1 > ERROR: could not load library "/opt/dbs/pgsql748-afilias-AIX53-2005-10-19/lib/plpgsql.so": A memory address is not in the address space for the process. > createlang: language installation failed: ERROR: could not load library "/opt/dbs/pgsql748-afilias-AIX53-2005-10-19/lib/plpgsql.so": A memory address is not in the address space for the process. > > The evident problem is actually on the permissions... The cause of the problem ended up being the default 32-bit memory model on AIX. The quick workarounds are chmoding all the libs to 755 and building postgres with the linker flag "-bmaxdata:0x40000000". > After modifying plpgsql.so to have "777" permissions (which was > doubtless more open than necessary, but hey, it took 2 seconds to > think of it :-)), the library loaded in fine. The 777 mode let plpgsql.so load because when the other-read bit is set, the dlopened library is loaded into the shared library text segment. When the bit is unset and the library isn't already in shared memory, dlopen tries to load the library into private memory. The default model only allows for part of a single 256M segment to be the user heap and it is too full to allow plpgsql.so to be dlopened into it. The previously mentioned option "-bmaxdata:0x40000000" causes the heap to be moved out of the process private segment and is instead allocated four segments (1G) of memory, reducing the amount of memory available to the process as shared memory to 1.75G. The first digit of the maxdata arg can be changed to a maximum of 8, and is the number of segments allocated to the heap at the expense of segments for shared memory. References: "Developing and Porting C and C++ Applications on AIX" Section 2.6: Dynamic loading (book page 82, pdf page 108) Section 2.9: Shared libraries in a development environment (book page 99, pdf page 125) Section 3.2: The 32-bit user process model (book page 109, pdf page 135) http://www.redbooks.ibm.com/redbooks/pdfs/sg245674.pdf http://www.redbooks.ibm.com/abstracts/sg245674.html?Open "Large Program Support" http://publib.boulder.ibm.com/infocenter/pseries/topic/com.ibm.aix.doc/aixprggd/genprogc/lrg_prg_support.htm -- Seneca Cunningham scunning@ca.afilias.info