Thread: FATAL: shmat(id=3342337) failed: Cannot allocate memory

FATAL: shmat(id=3342337) failed: Cannot allocate memory

From
Khangelani Gama
Date:

Hi all

 

We are running postgres 9.1 on CentOS 5. We can’t start up postgres . It complains about memory allocation . Please help

 

 

FATAL:  shmat(id=3342337) failed: Cannot allocate memory

 

 

# - Memory -

 

shared_buffers = 310251

                                        # (change requires restart)

#temp_buffers = 8MB                     # min 800kB

#max_prepared_transactions = 0          # zero disables the feature

                                        # (change requires restart)

# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory

# per transaction slot, plus lock space (see max_locks_per_transaction).

# It is not advisable to set max_prepared_transactions nonzero unless you

# actively intend to use prepared transactions.

work_mem = 32MB                         # min 64kB

maintenance_work_mem = 512MB            # min 1MB

#max_stack_depth = 2MB                  # min 100kB

 

 

 

 

/etc/sysctl.conf

 

# Controls the default maxmimum size of a mesage queue

kernel.msgmax = 65536

 

# Controls the maximum shared segment size, in bytes

kernel.shmmax = 4294967295

 

# Controls the maximum number of shared memory segments, in pages

kernel.shmall = 26843545

 

 

 

 

 

------ Shared Memory Segments --------

key        shmid      owner      perms      bytes      nattch     status

0x7a014a02 32768      zabbix    666        971500     6

 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems

0x7a014a02 0          zabbix    666        3

 

------ Message Queues --------

key        msqid      owner      perms      used-bytes   messages

 

 

 

Thanks

 

 

 


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.

Re: FATAL: shmat(id=3342337) failed: Cannot allocate memory

From
John R Pierce
Date:
On 4/23/2013 10:53 PM, Khangelani Gama wrote:
> We are running postgres 9.1 on CentOS 5. We can’t start up postgres .
> It complains about memory allocation . Please help
>
> FATAL:  shmat(id=3342337) failed: Cannot allocate memory
>

is that the entire error message?  it usually says something about
setting kernel.shmmax and/or shmall... for most flavors of linux, you
set these in /etc/sysctl.conf  (and then update the live system with
"sysctl -p").



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: FATAL: shmat(id=3342337) failed: Cannot allocate memory

From
Khangelani Gama
Date:
Hi  John

Yes that's the whole messege

# free -m

             total       used       free     shared    buffers     cached
Mem:          8079       1770       6309          0         95        549
-/+ buffers/cache:       1125       6953
Swap:         1023          0       1023


Thanks


-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of John R Pierce
Sent: Wednesday, April 24, 2013 7:58 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] FATAL: shmat(id=3342337) failed: Cannot allocate
memory

On 4/23/2013 10:53 PM, Khangelani Gama wrote:
> We are running postgres 9.1 on CentOS 5. We can't start up postgres .
> It complains about memory allocation . Please help
>
> FATAL:  shmat(id=3342337) failed: Cannot allocate memory
>

is that the entire error message?  it usually says something about setting
kernel.shmmax and/or shmall... for most flavors of linux, you set these in
/etc/sysctl.conf  (and then update the live system with "sysctl -p").



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by
anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer
immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no
liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.



Re: FATAL: shmat(id=3342337) failed: Cannot allocate memory

From
Khangelani Gama
Date:
# cat /proc/meminfo

MemTotal:        8273364 kB
MemFree:         6455204 kB
Buffers:           99180 kB
Cached:           564436 kB
SwapCached:            0 kB
Active:          1191560 kB
Inactive:         500768 kB
Active(anon):    1032072 kB
Inactive(anon):      456 kB
Active(file):     159488 kB
Inactive(file):   500312 kB
Unevictable:        4284 kB
Mlocked:            4284 kB
HighTotal:       7473504 kB
HighFree:        5863364 kB
LowTotal:         799860 kB
LowFree:          591840 kB
SwapTotal:       1048572 kB
SwapFree:        1048572 kB
Dirty:               196 kB
Writeback:             0 kB
AnonPages:       1033004 kB
Mapped:            34528 kB
Shmem:               556 kB
Slab:              89048 kB
SReclaimable:      43168 kB
SUnreclaim:        45880 kB
KernelStack:        2584 kB
PageTables:         4512 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     5185252 kB
Committed_AS:    1167668 kB
VmallocTotal:     122880 kB
VmallocUsed:        6928 kB
VmallocChunk:      70836 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        8184 kB
DirectMap2M:      905216 kB





-----Original Message-----
From: Khangelani Gama [mailto:kgama@argility.com]
Sent: Wednesday, April 24, 2013 8:09 AM
To: 'John R Pierce'; 'pgsql-general@postgresql.org'
Subject: RE: [GENERAL] FATAL: shmat(id=3342337) failed: Cannot allocate
memory

Hi  John

Yes that's the whole messege

# free -m

             total       used       free     shared    buffers     cached
Mem:          8079       1770       6309          0         95        549
-/+ buffers/cache:       1125       6953
Swap:         1023          0       1023


Thanks


-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of John R Pierce
Sent: Wednesday, April 24, 2013 7:58 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] FATAL: shmat(id=3342337) failed: Cannot allocate
memory

On 4/23/2013 10:53 PM, Khangelani Gama wrote:
> We are running postgres 9.1 on CentOS 5. We can't start up postgres .
> It complains about memory allocation . Please help
>
> FATAL:  shmat(id=3342337) failed: Cannot allocate memory
>

is that the entire error message?  it usually says something about setting
kernel.shmmax and/or shmall... for most flavors of linux, you set these in
/etc/sysctl.conf  (and then update the live system with "sysctl -p").



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by
anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer
immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no
liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.



Re: FATAL: shmat(id=3342337) failed: Cannot allocate memory

From
John R Pierce
Date:
On 4/23/2013 11:08 PM, Khangelani Gama wrote:
> Hi  John
>
> Yes that's the whole messege
>


well, try something like...

     kernel.shmmax = 4294967295
     kernel.shmall = 268435456

at the end of /etc/sysctl.conf, then execute `sysctl -p` and try to
start postgres again.

(it really doesn't matter if you set those kernel limits too large, they
have no negative impact, they are simply quota, the max allowed.   The
only reason to restrict them is on a shared system with
hostile/malicious users like students who might mess with grabbing
excessive memory and causing a denial of service. )




--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: FATAL: shmat(id=3342337) failed: Cannot allocate memory

From
Khangelani Gama
Date:
Thanks John, but someone have just fixed the problem. I still need to find
out about the fix.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of John R Pierce
Sent: Wednesday, April 24, 2013 8:18 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] FATAL: shmat(id=3342337) failed: Cannot allocate
memory

On 4/23/2013 11:08 PM, Khangelani Gama wrote:
> Hi  John
>
> Yes that's the whole messege
>


well, try something like...

     kernel.shmmax = 4294967295
     kernel.shmall = 268435456

at the end of /etc/sysctl.conf, then execute `sysctl -p` and try to start
postgres again.

(it really doesn't matter if you set those kernel limits too large, they
have no negative impact, they are simply quota, the max allowed.   The
only reason to restrict them is on a shared system with hostile/malicious
users like students who might mess with grabbing excessive memory and
causing a denial of service. )




--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by
anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer
immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no
liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.