PostgreSQL in FreeBSD jails

Jonathan Noack noackjr at
Mon May 2 14:29:27 PDT 2005

On 5/2/2005 4:03 PM, Marc G. Fournier wrote:
> yOn Mon, 2 May 2005, Richard Coleman wrote:
>> Dag-Erling Smørgrav wrote:
>>> There are two possible solutions:
>>>  - hack the SysV IPC code to use separate namespaces for each jail
>>>  - make PostgreSQL use POSIX shared memory instead of SysV shared
>>>    memory
>>> I suspect that the latter is significantly easier, and would probably
>>> improve performance as well.
>>> DES
>> It might be easier to hack PostgreSQL so that the shared memory 
>> identifier depends not only on the port, but also on the IP address 
>> (which will of course be different for each jail).  Or better yet, to 
>> be able to specify the shared memory identifier to use directly in the 
>> config file.
> You've all lost me here ... what exactly is the problem?  PostgreSQL 
> works under FreeBSD 4.x jails without any modifications, so how is 
> PostgreSQL itself currently broken?  It seems to me that the problem is 
> with FreeBSD 5.x's jail side of things, if the same daemon runs fine 
> under 4.x, but, nto under 5.x ...

 From my reading on this thread:
PostgreSQL generates the shared memory identifier based on the port it 
is running on, but (on 5.x at least) shared memory is not segregated 
between jails.  Thus, a new instance will corrupt the shared memory of 
another instance (in another jail, on another IP address, etc.) *if* 
they are running on the same port.  The workaround is to ensure every 
instance (regardless of jail or IP address) is running on a unique port.

Jonathan Noack | noackjr at | OpenPGP: 0x991D8195

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url :

More information about the freebsd-stable mailing list