Re: AIX Permission weirdness

Поиск
Список
Период
Сортировка
От Seneca Cunningham
Тема Re: AIX Permission weirdness
Дата
Msg-id 43909292.4070106@ca.afilias.info
обсуждение исходный текст
Ответ на AIX Permission weirdness  (Chris Browne <cbbrowne@acm.org>)
Список pgsql-ports
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
inthe 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

В списке pgsql-ports по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [HACKERS] Should libedit be preferred to libreadline?
Следующее
От: Mogin Mohandas
Дата:
Сообщение: building GIST indexes on Complex data type