Обсуждение: PG94RC1- plv8 functions - problem with input parameter length

Поиск
Список
Период
Сортировка

PG94RC1- plv8 functions - problem with input parameter length

От
Misa Simic
Дата:
Hi all,

We have found a strange problem with plv8 functions in PG94RC1

PG 9.3 works fine.

in PG94RC1 in plv8 functions regardless what function does i.e.nothing

CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1 text) RETURNS text
AS
$BODY$
return 'OK'
$BODY$ LANGUAGE plv8;

if length of in_param1 is higher then (or equal to) 200 characters connection just brake... current connection and it brakes - other connections as well... Not sure what it does - but all sessions just says server disconnected and we need and can reconect again....

ie.
SELECT test.test_text_length_plv8('aaaa') works fine

SELECT test.test_text_length_plv8('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

exactly 200 chars - just brake conncetion witout any message...but in separate session when we run next command it says:

WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.

We have tested using pgadmin and psql...

Versions:
PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1, 64-bit
plv8: 1.5.0-dev1

The same version of plv8 on PG9.3 - works fine without problems...

Any suggestions?

Thanks,

Misa




Re: PG94RC1- plv8 functions - problem with input parameter length

От
Misa Simic
Дата:


2014-11-28 16:56 GMT+01:00 Misa Simic <misa.simic@gmail.com>:
Hi all,

We have found a strange problem with plv8 functions in PG94RC1

PG 9.3 works fine.

in PG94RC1 in plv8 functions regardless what function does i.e.nothing

CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1 text) RETURNS text
AS
$BODY$
return 'OK'
$BODY$ LANGUAGE plv8;

if length of in_param1 is higher then (or equal to) 200 characters connection just brake... current connection and it brakes - other connections as well... Not sure what it does - but all sessions just says server disconnected and we need and can reconect again....

ie.
SELECT test.test_text_length_plv8('aaaa') works fine

SELECT test.test_text_length_plv8('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

exactly 200 chars - just brake conncetion witout any message...but in separate session when we run next command it says:

WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.

We have tested using pgadmin and psql...

Versions:
PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1, 64-bit
plv8: 1.5.0-dev1

The same version of plv8 on PG9.3 - works fine without problems...

Any suggestions?

Thanks,

Misa






Update:

all works fine and with: PostgreSQL 9.4beta1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit

Re: PG94RC1- plv8 functions - problem with input parameter length

От
Adrian Klaver
Дата:
On 11/28/2014 07:56 AM, Misa Simic wrote:
> Hi all,
>
> We have found a strange problem with plv8 functions in PG94RC1
>
> PG 9.3 works fine.
>
> in PG94RC1 in plv8 functions regardless what function does i.e.nothing
>
> CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1 text)
> RETURNS text
> AS
> $BODY$
> return 'OK'
> $BODY$ LANGUAGE plv8;
>
> if length of in_param1 is higher then (or equal to) 200 characters
> connection just brake... current connection and it brakes - other
> connections as well... Not sure what it does - but all sessions just
> says server disconnected and we need and can reconect again....
>
> ie.
> SELECT test.test_text_length_plv8('aaaa') works fine
>
> SELECT
>
test.test_text_length_plv8('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
>
> exactly 200 chars - just brake conncetion witout any message...but in
> separate session when we run next command it says:
>
> WARNING:  terminating connection because of crash of another server process
> DETAIL:  The postmaster has commanded this server process to roll back
> the current transaction and exit, because another server process exited
> abnormally and possibly corrupted shared memory.
> HINT:  In a moment you should be able to reconnect to the database and
> repeat your command.
>
> We have tested using pgadmin and psql...
>
> Versions:
> PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu
> 4.9.1-16ubuntu6) 4.9.1, 64-bit
> plv8: 1.5.0-dev1
>
> The same version of plv8 on PG9.3 - works fine without problems...
>
> Any suggestions?

Have you tried this with another language, say plpgsql, to see if this a
generic problem or specific to plV8?

>
> Thanks,
>
> Misa
>
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Adrian Klaver
Дата:
On 11/28/2014 08:05 AM, Misa Simic wrote:

>
> Update:
>
> all works fine and with: PostgreSQL 9.4beta1 on
> x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1)
> 4.8.2, 64-bit

Installed 9.4rc1 and tried with a plpgsql function and it worked with
parameters >= 200, so it seems plV8 specific or site specific.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Misa Simic
Дата:


On Friday, November 28, 2014, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 11/28/2014 07:56 AM, Misa Simic wrote:
Hi all,

We have found a strange problem with plv8 functions in PG94RC1

PG 9.3 works fine.

in PG94RC1 in plv8 functions regardless what function does i.e.nothing

CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1 text)
RETURNS text
AS
$BODY$
return 'OK'
$BODY$ LANGUAGE plv8;

if length of in_param1 is higher then (or equal to) 200 characters
connection just brake... current connection and it brakes - other
connections as well... Not sure what it does - but all sessions just
says server disconnected and we need and can reconect again....

ie.
SELECT test.test_text_length_plv8('aaaa') works fine

SELECT
test.test_text_length_plv8('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')

exactly 200 chars - just brake conncetion witout any message...but in
separate session when we run next command it says:

WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.

We have tested using pgadmin and psql...

Versions:
PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu
4.9.1-16ubuntu6) 4.9.1, 64-bit
plv8: 1.5.0-dev1

The same version of plv8 on PG9.3 - works fine without problems...

Any suggestions?

Have you tried this with another language, say plpgsql, to see if this a generic problem or specific to plV8?

Yes, plv8 specific..

Sql, plpgsql, plr, plpythonu work fine...

Though plv8 just produce problems in rc1.. Beta1 no probs....

 


Thanks,

Misa






--
Adrian Klaver
adrian.klaver@aklaver.com

Re: PG94RC1- plv8 functions - problem with input parameter length

От
Adrian Klaver
Дата:
On 11/28/2014 12:18 PM, Misa Simic wrote:
>
>
> On Friday, November 28, 2014, Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 11/28/2014 07:56 AM, Misa Simic wrote:
>
>         Hi all,
>
>         We have found a strange problem with plv8 functions in PG94RC1
>
>         PG 9.3 works fine.
>
>         in PG94RC1 in plv8 functions regardless what function does
>         i.e.nothing
>
>         CREATE OR REPLACE FUNCTION
>         test.test_text_length_plv8(in___param1 text)
>         RETURNS text
>         AS
>         $BODY$
>         return 'OK'
>         $BODY$ LANGUAGE plv8;
>
>         if length of in_param1 is higher then (or equal to) 200 characters
>         connection just brake... current connection and it brakes - other
>         connections as well... Not sure what it does - but all sessions just
>         says server disconnected and we need and can reconect again....
>
>         ie.
>         SELECT test.test_text_length_plv8('__aaaa') works fine
>
>         SELECT
>
test.test_text_length_plv8('__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaa')
>
>         exactly 200 chars - just brake conncetion witout any
>         message...but in
>         separate session when we run next command it says:
>
>         WARNING:  terminating connection because of crash of another
>         server process
>         DETAIL:  The postmaster has commanded this server process to
>         roll back
>         the current transaction and exit, because another server process
>         exited
>         abnormally and possibly corrupted shared memory.
>         HINT:  In a moment you should be able to reconnect to the
>         database and
>         repeat your command.
>
>         We have tested using pgadmin and psql...
>
>         Versions:
>         PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc
>         (Ubuntu
>         4.9.1-16ubuntu6) 4.9.1, 64-bit
>         plv8: 1.5.0-dev1
>
>         The same version of plv8 on PG9.3 - works fine without problems...
>
>         Any suggestions?
>
>
>     Have you tried this with another language, say plpgsql, to see if
>     this a generic problem or specific to plV8?
>
>
> Yes, plv8 specific..
>
> Sql, plpgsql, plr, plpythonu work fine...
>
> Though plv8 just produce problems in rc1.. Beta1 no probs....

Given that other PLs are not having problems, this is probably something
that needs to be brought up with the plV8 maintainers:

https://code.google.com/p/plv8js/wiki/PLV8

https://code.google.com/p/plv8js/issues/list

A look at plv8 repo shows the last change was June 7, 2014. A lot has
happened since then in the Postgres 9.4 code, so it is entirely possible
the plv8 code is not aware of the changes.

To get more specific information you could try:

https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD

>
>
>
>         Thanks,
>
>         Misa
>
>
>
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Misa Simic
Дата:


On Friday, November 28, 2014, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 11/28/2014 12:18 PM, Misa Simic wrote:


On Friday, November 28, 2014, Adrian Klaver <adrian.klaver@aklaver.com
<mailto:adrian.klaver@aklaver.com>> wrote:

    On 11/28/2014 07:56 AM, Misa Simic wrote:

        Hi all,

        We have found a strange problem with plv8 functions in PG94RC1

        PG 9.3 works fine.

        in PG94RC1 in plv8 functions regardless what function does
        i.e.nothing

        CREATE OR REPLACE FUNCTION
        test.test_text_length_plv8(in___param1 text)
        RETURNS text
        AS
        $BODY$
        return 'OK'
        $BODY$ LANGUAGE plv8;

        if length of in_param1 is higher then (or equal to) 200 characters
        connection just brake... current connection and it brakes - other
        connections as well... Not sure what it does - but all sessions just
        says server disconnected and we need and can reconect again....

        ie.
        SELECT test.test_text_length_plv8('__aaaa') works fine

        SELECT
        test.test_text_length_plv8('__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa__aaaaaaaaaaaaaaaaaaaa')

        exactly 200 chars - just brake conncetion witout any
        message...but in
        separate session when we run next command it says:

        WARNING:  terminating connection because of crash of another
        server process
        DETAIL:  The postmaster has commanded this server process to
        roll back
        the current transaction and exit, because another server process
        exited
        abnormally and possibly corrupted shared memory.
        HINT:  In a moment you should be able to reconnect to the
        database and
        repeat your command.

        We have tested using pgadmin and psql...

        Versions:
        PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc
        (Ubuntu
        4.9.1-16ubuntu6) 4.9.1, 64-bit
        plv8: 1.5.0-dev1

        The same version of plv8 on PG9.3 - works fine without problems...

        Any suggestions?


    Have you tried this with another language, say plpgsql, to see if
    this a generic problem or specific to plV8?


Yes, plv8 specific..

Sql, plpgsql, plr, plpythonu work fine...

Though plv8 just produce problems in rc1.. Beta1 no probs....

Given that other PLs are not having problems, this is probably something that needs to be brought up with the plV8 maintainers:

https://code.google.com/p/plv8js/wiki/PLV8

https://code.google.com/p/plv8js/issues/list

A look at plv8 repo shows the last change was June 7, 2014. A lot has happened since then in the Postgres 9.4 code, so it is entirely possible the plv8 code is not aware of the changes.

To get more specific information you could try:

https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD




        Thanks,

        Misa






    --
    Adrian Klaver
    adrian.klaver@aklaver.com



--
Adrian Klaver
adrian.klaver@aklaver.com

Thanks Adrian,

Not sure any more where problem could be....

We have just found that it creates problems on machines with ubuntu 14.10 (pg94rc1) - we have tried to install 14.10 in different environments (cloud, xen, virtual box) - and everywhere problems happens...

Other wierd thing problem hapens just if input parametar length is 200-255. 256 work fine.

We have noticed that other versions of pg (i.e 9.3, 94beta1) what work fine are on different version of ubuntu. So we have tried pg94rc1 on ubuntu 14.04 - and work fine...

We haven't tried other OS...

Thanks,
Misa


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Adrian Klaver
Дата:
On 12/01/2014 07:20 AM, Misa Simic wrote:
>

>
> Thanks Adrian,
>
> Not sure any more where problem could be....

Best guess, interaction of plV8 with system libV8 libraries and some
change in 9.4rc1. Not very specific I know. plv8 is not part of the core
software for Postgres, so to make progress on this you will need to file
an issue with its maintainers:

https://code.google.com/p/plv8js/issues/list

I would use the problem description below.

>
> We have just found that it creates problems on machines with ubuntu
> 14.10 (pg94rc1) - we have tried to install 14.10 in different
> environments (cloud, xen, virtual box) - and everywhere problems happens...
>
> Other wierd thing problem hapens just if input parametar length is
> 200-255. 256 work fine.
>
> We have noticed that other versions of pg (i.e 9.3, 94beta1) what work
> fine are on different version of ubuntu. So we have tried pg94rc1 on
> ubuntu 14.04 - and work fine...
>
> We haven't tried other OS...
>
> Thanks,
> Misa
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Adrian Klaver
Дата:
On 12/01/2014 07:20 AM, Misa Simic wrote:
>
>

>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com
>
>
> Thanks Adrian,
>
> Not sure any more where problem could be....
>
> We have just found that it creates problems on machines with ubuntu
> 14.10 (pg94rc1) - we have tried to install 14.10 in different
> environments (cloud, xen, virtual box) - and everywhere problems happens...
>
> Other wierd thing problem hapens just if input parametar length is
> 200-255. 256 work fine.

Another thought. The above looks like the parameter is hitting a limit
within a byte and them when it gets big enough another byte is
allocated. If that is the case you should see the issue crop up again at
the 400-510 range.

Along this line what encoding are you using?

>
> We have noticed that other versions of pg (i.e 9.3, 94beta1) what work
> fine are on different version of ubuntu. So we have tried pg94rc1 on
> ubuntu 14.04 - and work fine...
>
> We haven't tried other OS...
>
> Thanks,
> Misa
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Andres Freund
Дата:
On 2014-12-01 16:20:54 +0100, Misa Simic wrote:
> We have just found that it creates problems on machines with ubuntu 14.10
> (pg94rc1) - we have tried to install 14.10 in different environments
> (cloud, xen, virtual box) - and everywhere problems happens...

I suggest running postgres under valgrind - it tends to be very useful
to analyze problems like this. To do so run valgrind like
valgrind --suppress
valgrind \
    --suppressions=/path/to/source/postgresql/src/tools/valgrind.supp \
    --trace-children=yes --track-origins=yes --read-var-info=yes \
    /path/to/postgres/install/bin/postgres -D ...

You should compile postgres with --enable-cassert to debug.

> Other wierd thing problem hapens just if input parametar length is 200-255.
> 256 work fine.

That sounds a bit like it might be toast related. Maybe plv8's parameter
handling isn't entirely correct?

Greetings,

Andres Freund

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


Re: PG94RC1- plv8 functions - problem with input parameter length

От
Ilya Ashchepkov
Дата:
On Fri, 28 Nov 2014 16:56:01 +0100
Misa Simic <misa.simic@gmail.com> wrote:

> Hi all,

Hello, on Debian Sid and all works fine.
postgresql-9.4:
  Installed: 9.4~rc1-1.pgdg+1
from http://apt.postgresql.org/
plv8js from https://code.google.com/p/plv8js/

>
> We have found a strange problem with plv8 functions in PG94RC1
>
> PG 9.3 works fine.
>
> in PG94RC1 in plv8 functions regardless what function does i.e.nothing
>
> CREATE OR REPLACE FUNCTION test.test_text_length_plv8(in_param1 text)
> RETURNS text
> AS
> $BODY$
> return 'OK'
> $BODY$ LANGUAGE plv8;
>
> if length of in_param1 is higher then (or equal to) 200 characters
> connection just brake... current connection and it brakes - other
> connections as well... Not sure what it does - but all sessions just
> says server disconnected and we need and can reconect again....
>
> ie.
> SELECT test.test_text_length_plv8('aaaa') works fine
>
> SELECT
>
test.test_text_length_plv8('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
>
> exactly 200 chars - just brake conncetion witout any message...but in
> separate session when we run next command it says:
>
> WARNING:  terminating connection because of crash of another server
> process DETAIL:  The postmaster has commanded this server process to
> roll back the current transaction and exit, because another server
> process exited abnormally and possibly corrupted shared memory.
> HINT:  In a moment you should be able to reconnect to the database and
> repeat your command.
>
> We have tested using pgadmin and psql...
>
> Versions:
> PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu
> 4.9.1-16ubuntu6) 4.9.1, 64-bit
> plv8: 1.5.0-dev1
>
> The same version of plv8 on PG9.3 - works fine without problems...
>
> Any suggestions?
>
> Thanks,
>
> Misa
>