requested shared memory size overflows size_t

Lists: pgsql-hackers
From: Yuri Levinsky <yuril(at)celltick(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: requested shared memory size overflows size_t
Date: 2014-03-04 09:59:02
Message-ID: C9278837BA426D4DBDF8996DB8902326128E0E@Cobra.celltick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dear Developers,
Please help with the following problem. I am running PostgreSQL 9.2.3 on SUN Solaris 9. This is 64 bit system with 32G swap and 16G RAM. I use same configuration file as on Linux or SUN Solaris 10, where everything is ok. I am unable to set shared buffer 5G, the maximum possible value is 4G. When I decrease the configuration parameters and start the instance successfully: some queries fails on "out of memory" error. I verified kernel parameters: they looks same as on Solaris 10 and big enough. The only one difference is: Solaris 9 PostgreSQL version, in opposite to Solaris 10 and Linux, was compiled by me with default options.
My kernel is:
set semsys:seminfo_semmap=64
set semsys:seminfo_semmni=4096
set semsys:seminfo_semmns=4096
set semsys:seminfo_semmnu=4096
set semsys:seminfo_semume=64
set semsys:seminfo_semmsl=500
set shmsys:shminfo_shmmax=0xffffffffffff
set shmsys:shminfo_shmmin=100
set shmsys:shminfo_shmmni=4096
set shmsys:shminfo_shmseg=100

Config.
shared_buffers = 3GB
temp_buffers = 2GB
work_mem = 1024MB

Sincerely yours,

[Description: Celltick logo_highres]
Yuri Levinsky, DBA
Celltick Technologies Ltd., 32 Maskit St., Herzliya 46733, Israel
Mobile: +972 54 6107703, Office: +972 9 9710239; Fax: +972 9 9710222


From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Yuri Levinsky <yuril(at)celltick(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-04 10:32:34
Message-ID: 5315ABC2.9000002@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 03/04/2014 11:59 AM, Yuri Levinsky wrote:
> Dear Developers,
> Please help with the following problem. I am running PostgreSQL 9.2.3 on SUN Solaris 9. This is 64 bit system with 32G swap and 16G RAM. I use same configuration file as on Linux or SUN Solaris 10, where everything is ok. I am unable to set shared buffer 5G, the maximum possible value is 4G. When I decrease the configuration parameters and start the instance successfully: some queries fails on "out of memory" error. I verified kernel parameters: they looks same as on Solaris 10 and big enough. The only one difference is: Solaris 9 PostgreSQL version, in opposite to Solaris 10 and Linux, was compiled by me with default options.

Note that if a query fails with "out of memory", it does *not* mean that
you should increase shared_buffers. On the contrary: the higher you set
shared_buffers, the less memory there is left for other things.

> My kernel is:
> set semsys:seminfo_semmap=64
> set semsys:seminfo_semmni=4096
> set semsys:seminfo_semmns=4096
> set semsys:seminfo_semmnu=4096
> set semsys:seminfo_semume=64
> set semsys:seminfo_semmsl=500
> set shmsys:shminfo_shmmax=0xffffffffffff
> set shmsys:shminfo_shmmin=100
> set shmsys:shminfo_shmmni=4096
> set shmsys:shminfo_shmseg=100
>
> Config.
> shared_buffers = 3GB
> temp_buffers = 2GB
> work_mem = 1024MB

temp_buffers = 2GB seems very high. That settings is *per backend*, so
if you have 10 backends that all use temporary tables, they will consume
20GB altogether for temp buffers. work_mem works similarly, except that
a single query can use many times work_mem even in a single backend, so
you need to be even more conservative with that. 1GB seems very high for
work_mem. Try resetting these back to the defaults, and see if that
works for you. Increase them gradually, and only if you have a query
where the higher value really helps.

- Heikki


From: Yuri Levinsky <yuril(at)celltick(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-04 11:05:10
Message-ID: C9278837BA426D4DBDF8996DB8902326128E6C@Cobra.celltick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Heikki,

I changed postgresql.conf to decrease those parameters but no change: GMT54000FATAL: requested shared memory size overflows size_t

> My kernel is:
> set semsys:seminfo_semmap=64
> set semsys:seminfo_semmni=4096
> set semsys:seminfo_semmns=4096
> set semsys:seminfo_semmnu=4096
> set semsys:seminfo_semume=64
> set semsys:seminfo_semmsl=500
> set shmsys:shminfo_shmmax=0xffffffffffff
> set shmsys:shminfo_shmmin=100
> set shmsys:shminfo_shmmni=4096
> set shmsys:shminfo_shmseg=100
>
shared_buffers = 5GB # min 16 or max_connections*2, 8KB each
temp_buffers = 256MB # min 100, 8KB each
max_prepared_transactions = 1000 # can be 0 or more
# 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 = 256MB # min 64, size in KB
maintenance_work_mem = 256MB # min 1024, size in KB
max_stack_depth = 4MB
[L.Y.]

temp_buffers = 2GB seems very high. That settings is *per backend*, so if you have 10 backends that all use temporary tables, they will consume 20GB altogether for temp buffers. work_mem works similarly, except that a single query can use many times work_mem even in a single backend, so you need to be even more conservative with that. 1GB seems very high for work_mem. Try resetting these back to the defaults, and see if that works for you. Increase them gradually, and only if you have a query where the higher value really helps.

- Heikki


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Yuri Levinsky <yuril(at)celltick(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-04 14:30:52
Message-ID: CA+Tgmoa2W+zyhJGQzML=hgn8i5iQP+PLJWnD5DX7NnCMS3a08A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Mar 4, 2014 at 6:05 AM, Yuri Levinsky <yuril(at)celltick(dot)com> wrote:
> I changed postgresql.conf to decrease those parameters but no change: GMT54000FATAL: requested shared memory size overflows size_t

I think this means you are running on a 32-bit operating system, or at
least on a 32-bit build. That means you can't use more than 4GB of
address space per process, which has to fit shared_buffers and
everything else. Typically it's best not to set shared_buffers above
2-2.5GB on such systems, but the real solution is to use a 64-bit
PostgreSQL.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Yuri Levinsky <yuril(at)celltick(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-04 14:53:49
Message-ID: C9278837BA426D4DBDF8996DB8902326128F66@Cobra.celltick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert,
Please advise me: I just downloaded the source and compiled it. Sun Spark Solaris 9 is always 64 bit, I verified it with sys admin. He may run 32 bit applications as well. Have I use some special option during compilation to verify that compiled PostgreSQL is actually 64 bit app?

Sincerely yours,

Yuri Levinsky, DBA
Celltick Technologies Ltd., 32 Maskit St., Herzliya 46733, Israel
Mobile: +972 54 6107703, Office: +972 9 9710239; Fax: +972 9 9710222

-----Original Message-----
From: Robert Haas [mailto:robertmhaas(at)gmail(dot)com]
Sent: Tuesday, March 04, 2014 4:31 PM
To: Yuri Levinsky
Cc: Heikki Linnakangas; pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] requested shared memory size overflows size_t

On Tue, Mar 4, 2014 at 6:05 AM, Yuri Levinsky <yuril(at)celltick(dot)com> wrote:
> I changed postgresql.conf to decrease those parameters but no change:
> GMT54000FATAL: requested shared memory size overflows size_t

I think this means you are running on a 32-bit operating system, or at least on a 32-bit build. That means you can't use more than 4GB of address space per process, which has to fit shared_buffers and everything else. Typically it's best not to set shared_buffers above 2-2.5GB on such systems, but the real solution is to use a 64-bit PostgreSQL.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Yuri Levinsky <yuril(at)celltick(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-04 16:29:38
Message-ID: CA+TgmoYzcAxbpJ-myo_G+MEQwYLV+JEF=8FLMK=vsfbR8erJQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Mar 4, 2014 at 9:53 AM, Yuri Levinsky <yuril(at)celltick(dot)com> wrote:
> Robert,
> Please advise me: I just downloaded the source and compiled it. Sun Spark Solaris 9 is always 64 bit, I verified it with sys admin. He may run 32 bit applications as well. Have I use some special option during compilation to verify that compiled PostgreSQL is actually 64 bit app?

Sorry, I'm not familiar with compiling PostgreSQL on Solaris.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Yuri Levinsky <yuril(at)celltick(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-14 02:41:26
Message-ID: 53226C56.6000101@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 03/04/2014 10:53 PM, Yuri Levinsky wrote:
> Please advise me: I just downloaded the source and compiled it. Sun Spark Solaris 9 is always 64 bit, I verified it with sys admin. He may run 32 bit applications as well. Have I use some special option during compilation to verify that compiled PostgreSQL is actually 64 bit app?

Many platforms include both 32-bit and 64-bit target toolchains. So you
might be on a 64-bit platform, but that doesn't mean you aren't
compiling a 32-bit executable.

Please run:

grep '^#define SIZEOF' config.log

and post the results.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Yuri Levinsky <yuril(at)celltick(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-16 10:57:50
Message-ID: C9278837BA426D4DBDF8996DB890232612AA4E@Cobra.celltick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dear Craig,
The output is:
#define SIZEOF_OFF_T 8
#define SIZEOF_VOID_P 4
#define SIZEOF_SIZE_T 4
#define SIZEOF_LONG 4

Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.6

Sincerely yours,

Yuri Levinsky, DBA
Celltick Technologies Ltd., 32 Maskit St., Herzliya 46733, Israel
Mobile: +972 54 6107703, Office: +972 9 9710239; Fax: +972 9 9710222

-----Original Message-----
From: Craig Ringer [mailto:craig(at)2ndquadrant(dot)com] /define
Sent: Friday, March 14, 2014 4:41 AM
To: Yuri Levinsky; Robert Haas
Cc: Heikki Linnakangas; pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] requested shared memory size overflows size_t

On 03/04/2014 10:53 PM, Yuri Levinsky wrote:
> Please advise me: I just downloaded the source and compiled it. Sun Spark Solaris 9 is always 64 bit, I verified it with sys admin. He may run 32 bit applications as well. Have I use some special option during compilation to verify that compiled PostgreSQL is actually 64 bit app?

Many platforms include both 32-bit and 64-bit target toolchains. So you might be on a 64-bit platform, but that doesn't mean you aren't compiling a 32-bit executable.

Please run:

grep '^#define SIZEOF' config.log

and post the results.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Yuri Levinsky <yuril(at)celltick(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-16 12:39:53
Message-ID: 53259B99.7070501@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 03/16/2014 06:57 PM, Yuri Levinsky wrote:
> Dear Craig,
> The output is:
> #define SIZEOF_OFF_T 8
> #define SIZEOF_VOID_P 4
> #define SIZEOF_SIZE_T 4

OK, that confirms you have done a 32-bit build.

You need to figure out how to invoke the 64-bit toolchain on your
Solaris version. You might need to alter the PATH environment variable
or set architecture-specific CFLAGS.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Yuri Levinsky <yuril(at)celltick(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: requested shared memory size overflows size_t
Date: 2014-03-16 14:06:19
Message-ID: C9278837BA426D4DBDF8996DB890232612AC80@Cobra.celltick.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Craig,
Is this output correct now?
#define SIZEOF_OFF_T 8
#define SIZEOF_VOID_P 8
#define SIZEOF_SIZE_T 8
#define SIZEOF_LONG 8

Sincerely yours,

Yuri Levinsky, DBA
Celltick Technologies Ltd., 32 Maskit St., Herzliya 46733, Israel
Mobile: +972 54 6107703, Office: +972 9 9710239; Fax: +972 9 9710222

-----Original Message-----
From: Craig Ringer [mailto:craig(at)2ndquadrant(dot)com]
Sent: Sunday, March 16, 2014 2:40 PM
To: Yuri Levinsky; Robert Haas
Cc: Heikki Linnakangas; pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] requested shared memory size overflows size_t

On 03/16/2014 06:57 PM, Yuri Levinsky wrote:
> Dear Craig,
> The output is:
> #define SIZEOF_OFF_T 8
> #define SIZEOF_VOID_P 4
> #define SIZEOF_SIZE_T 4

OK, that confirms you have done a 32-bit build.

You need to figure out how to invoke the 64-bit toolchain on your Solaris version. You might need to alter the PATH environment variable or set architecture-specific CFLAGS.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services