Thread: BUG #3520: insert causing error "invalid memory alloc request size 2147483648"

BUG #3520: insert causing error "invalid memory alloc request size 2147483648"

From
"Brodie Thiesfield"
Date:
The following bug has been logged online:

Bug reference:      3520
Logged by:          Brodie Thiesfield
Email address:      brofield2@jellycan.com
PostgreSQL version: 8.2.4
Operating system:   Windows XP SP2
Description:        insert causing error "invalid memory alloc request size
2147483648"
Details:

See SQL script and output at:
http://jellycan.com/etc/postgres-bug.zip

STEPS TO REPRODUCE

See attached file postgre-bug.sql
Execute with "psql dbname < postgre.bug"

Note that this testcase has been reduced as much as appears possible.
Changes to the script will cause the error to go away (e.g. reducing the
number of strings, removing the analyse statements). The error will also
disappear if the data is dumped/loaded with pg_dump and the INSERT statement
executed.

OUTPUT

(at time of final INSERT)
ERROR:  XX000: invalid memory alloc request size 2147483648
LOCATION:  MemoryContextAlloc, mcxt.c:504

See attached file postgre-bug.out

OUTPUT EXPECTED

No error (same SQL works fine in sqlite and MS SQL).

INSTALLATION

>psql --version
psql (PostgreSQL) 8.2.4

Upgrade installation from 8.2.2 using installer, default options.
Error also existed in version 8.2.2
Running on Windows XP SP2 (Japanese)
"Brodie Thiesfield" <brofield2@jellycan.com> writes:

> (at time of final INSERT)
> ERROR:  XX000: invalid memory alloc request size 2147483648
> LOCATION:  MemoryContextAlloc, mcxt.c:504

Some questions: what encoding was the database created in? And what locale is
your server running in?

The commands which would be useful to answer the above are:

postgres=# \l
       List of databases
   Name    | Owner | Encoding
-----------+-------+-----------
 postgres  | stark | SQL_ASCII
 template0 | stark | SQL_ASCII
 template1 | stark | SQL_ASCII
(3 rows)

postgres=# show all;
              name               |            setting             |
    description                                                           

---------------------------------+--------------------------------+-------------------------------------------------------------------------------------------------------------------------------
 add_missing_from                | off                            | Automatically adds missing table references to FROM
clauses.
...




--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

Re: BUG #3520: insert causing error "invalid memory alloc request size 2147483648"

From
Magnus Hagander
Date:
On Tue, Aug 07, 2007 at 03:41:07AM +0000, Brodie Thiesfield wrote:
>
> The following bug has been logged online:
>
> Bug reference:      3520
> Logged by:          Brodie Thiesfield
> Email address:      brofield2@jellycan.com
> PostgreSQL version: 8.2.4
> Operating system:   Windows XP SP2
> Description:        insert causing error "invalid memory alloc request size
> 2147483648"
> Details:
>
> See SQL script and output at:
> http://jellycan.com/etc/postgres-bug.zip

This looks like it could be this bug:
http://archives.postgresql.org/pgsql-committers/2007-05/msg00088.php

I've been unable to reproduce it on CVS HEAD, which could be why.

What encoding is your database in? Is it also UTF-8?

//Magnus

Re: BUG #3520: insert causing error "invalid memory alloc request size 2147483648"

From
"Brodie Thiesfield"
Date:
The database is created in UTF-8.
CREATE DATABASE crossbase WITH OWNER = tserver ENCODING = 'UTF-8';

postgres=# \l
       List of databases
  Name    |  Owner   | Encoding
-----------+----------+----------
 crossbase | tserver  | UTF8
 crosstest | postgres | UTF8
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8

System locale is Japanese cp932.
lc_collate                      | Japanese_Japan.932
lc_ctype                        | Japanese_Japan.932
lc_messages                     | Japanese_Japan.932
lc_monetary                     | Japanese_Japan.932
lc_numeric                      | Japanese_Japan.932
lc_time                         | Japanese_Japan.932

If there are any other settings you need from show all then it is in
the attached file.

Regards,
Brodie

On 8/7/07, Magnus Hagander <magnus@hagander.net> wrote:
> On Tue, Aug 07, 2007 at 03:41:07AM +0000, Brodie Thiesfield wrote:
> >
> > The following bug has been logged online:
> >
> > Bug reference:      3520
> > Logged by:          Brodie Thiesfield
> > Email address:      brofield2@jellycan.com
> > PostgreSQL version: 8.2.4
> > Operating system:   Windows XP SP2
> > Description:        insert causing error "invalid memory alloc request size
> > 2147483648"
> > Details:
> >
> > See SQL script and output at:
> > http://jellycan.com/etc/postgres-bug.zip
>
> This looks like it could be this bug:
> http://archives.postgresql.org/pgsql-committers/2007-05/msg00088.php
>
> I've been unable to reproduce it on CVS HEAD, which could be why.
>
> What encoding is your database in? Is it also UTF-8?
>
> //Magnus
>

Attachment

Re: BUG #3520: insert causing error "invalid memory alloc request size 2147483648"

From
Magnus Hagander
Date:
Brodie Thiesfield wrote:
> The database is created in UTF-8.
> CREATE DATABASE crossbase WITH OWNER = tserver ENCODING = 'UTF-8';
>
> postgres=# \l
>        List of databases
>   Name    |  Owner   | Encoding
> -----------+----------+----------
>  crossbase | tserver  | UTF8
>  crosstest | postgres | UTF8
>  postgres  | postgres | UTF8
>  template0 | postgres | UTF8
>  template1 | postgres | UTF8
>
> System locale is Japanese cp932.
> lc_collate                      | Japanese_Japan.932
> lc_ctype                        | Japanese_Japan.932
> lc_messages                     | Japanese_Japan.932
> lc_monetary                     | Japanese_Japan.932
> lc_numeric                      | Japanese_Japan.932
> lc_time                         | Japanese_Japan.932
>
> If there are any other settings you need from show all then it is in
> the attached file.

It certainly looks like that bug. Any chance you're experienced enough
to set a breakpoint at it and get a backtrace when the error shows up?
(I know it's very difficult on windows with the current version). Or if
you can try the tip of the REL8_2_STABLE branch in cvs?

//Magnus