Discussion:
FreeBSD & Shared Memory
(too old to reply)
Michael Fork
2004-06-11 23:24:00 UTC
Permalink
All,

I am trying to get Postgres running on FreeBSD and am
running into problems
with shared mem. Here is the postgres error messge:

FATAL: could not create shared memory segment: Cannot
allocate memory
DETAIL: Failed system call was shgmet(key=5432001,
size=103407616, 03600).
HINT: This error usually means that PostgreSQL's
request for a shared
memory segment exceeded available memory or swap
space.
To reduce the request size (currently 103407616
bytes), reduce PostgreSQL's
shared_buffers parameter (currently 12288) and/or its
max_connections
parameter (cureently 40).
The PostgreSQL documentation contains more information
about shared memory
configuration.

Here is the output of sysctl (which shows there is
more shared mem available
than postgres is asking for):

bash-2.05b$ sysctl -a | grep shm
kern.ipc.shmmax: 200000000
kern.ipc.shmmin: 1
kern.ipc.shmmni: 192
kern.ipc.shmseg: 128
kern.ipc.shmall: 8192
kern.ipc.shm_use_phys: 0

and finally the IPC stats which shows nothing being
used:

Message Queues:
T ID KEY MODE OWNER GROUP

Shared Memory:
T ID KEY MODE OWNER GROUP

Semaphores:
T ID KEY MODE OWNER GROUP

Any ideas why postgres won't start?

Thanks.

Michael



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly
Tom Lane
2004-06-12 17:25:53 UTC
Permalink
Post by Michael Fork
Here is the output of sysctl (which shows there is
bash-2.05b$ sysctl -a | grep shm
kern.ipc.shmmax: 200000000
kern.ipc.shmmin: 1
kern.ipc.shmmni: 192
kern.ipc.shmseg: 128
kern.ipc.shmall: 8192
kern.ipc.shm_use_phys: 0
I forget exactly what units shmall is measured in, but I'm pretty sure
that 8192 isn't enough to allow 100MB of shared memory.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Bender, Cheryl
2004-06-14 13:36:22 UTC
Permalink
Michael;

What version of FreeBSD? What version of PostGres?
On my server, running FreeBSD 5.1 and pg 7.3, the values are

kern.ipc.shmmax: 33554432
kern.ipc.shmmin: 1
kern.ipc.shmmni: 192
kern.ipc.shmseg: 128
kern.ipc.shmall: 8192
kern.ipc.shm_use_phys: 0
shm 30 35K 38K 4653 16,1024,16384

I found this script (
http://developer.postgresql.org/docs/pgsql/contrib/ipc_check/ ) for
freebsd that checks if changes are needed to shared memory settings for
the number of Buffers requested. The postmaster man page says the
default buffers are 64, so I ran it with the -B 64 switch and it gave me
the following output

--------------
Bash2.05b$./ipc_check -B 64

shared memory enabled: 32768 kB available

no changes to kernel required for a "-B 64" setting

==========================

semaphores enabled
------------------

Hopefully someone with a lot more experience than me will answer soon
with a better answer, but maybe this will get you started. Good luck!

Cheryl

-----Original Message-----
From: pgsql-admin-***@postgresql.org
[mailto:pgsql-admin-***@postgresql.org] On Behalf Of Michael Fork
Sent: Friday, June 11, 2004 6:24 PM
To: pgsql-***@postgresql.org
Subject: [ADMIN] FreeBSD & Shared Memory


All,

I am trying to get Postgres running on FreeBSD and am
running into problems
with shared mem. Here is the postgres error messge:

FATAL: could not create shared memory segment: Cannot
allocate memory
DETAIL: Failed system call was shgmet(key=5432001, size=103407616,
03600).
HINT: This error usually means that PostgreSQL's
request for a shared
memory segment exceeded available memory or swap
space.
To reduce the request size (currently 103407616
bytes), reduce PostgreSQL's
shared_buffers parameter (currently 12288) and/or its max_connections
parameter (cureently 40). The PostgreSQL documentation contains more
information about shared memory configuration.

Here is the output of sysctl (which shows there is
more shared mem available
than postgres is asking for):

bash-2.05b$ sysctl -a | grep shm
kern.ipc.shmmax: 200000000
kern.ipc.shmmin: 1
kern.ipc.shmmni: 192
kern.ipc.shmseg: 128
kern.ipc.shmall: 8192
kern.ipc.shm_use_phys: 0

and finally the IPC stats which shows nothing being
used:

Message Queues:
T ID KEY MODE OWNER GROUP

Shared Memory:
T ID KEY MODE OWNER GROUP

Semaphores:
T ID KEY MODE OWNER GROUP

Any ideas why postgres won't start?

Thanks.

Michael



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Loading...