pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
5+ messages / 5 participants
[nested] [flat]

* BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
@ 2016-08-02 06:22  hargudekishor@gmail.com
  0 siblings, 1 reply; 5+ messages in thread

From: hargudekishor@gmail.com @ 2016-08-02 06:22 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14273
Logged by:          Kishor Hargude
Email address:      hargudekishor@gmail.com
PostgreSQL version: 9.4.8
Operating system:   Ubuntu
Description:        

Hi,

I am facing a strange issue on postgresql-9.4.8.

below is the description of the issue.

We have connected our node js application with postgresql-9.4.8.We have
several functions which are getting created in database using async call
from nodejs to postgresql server.but while creating those functions ,We are
encountered a error of "Tuple concurrently updated".And because of this
error our node js application is getting terminated.which is not affordable
to us.

Below is the exact error lines from node js app logs.

 [error: tuple concurrently updated]
  name: 'error',
  length: 83,
  severity: 'ERROR',
  code: 'XX000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'heapam.c',
  line: '4097',
  routine: 'simple_heap_update' }
error: tuple concurrently updated
    at Connection.parseE
(/var/www/tea/tea/gamma/node_modules/pg/lib/connection.js:539:11)
    at Connection.parseMessage
(/var/www/tea/tea/gamma/node_modules/pg/lib/connection.js:366:17)
    at Socket.<anonymous>
(/var/www/tea/tea/gamma/node_modules/pg/lib/connection.js:105:22)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)
    at emitReadable (_stream_readable.js:422:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at TCP.onread (net.js:528:21)

********************************************
Below is the exact error lines from PG logs.

 tuple concurrently updated
2016-08-02 10:13:06 IST:[unknown]:teadbuser:teadb_mixdbSTATEMENT:  DROP
FUNCTION IF EXISTS get_changeoverview_new_added_components(integer,
character varying,character varying,character varying, numeric, numeric);
        
        CREATE OR REPLACE FUNCTION
get_changeoverview_new_added_components(
.
.
.
.

We tried to execute those function by setting transaction_isolation to
serializable but encountered same issue.

Please suggest me that,How can I bypass this error...OR is it a bug about
severity of message ("tuple concurrently updated")on this kind of issue
.Should it be only warning ?

--
Kishor.






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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
@ 2016-08-02 18:00  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: hargudekishor@gmail.com
  0 siblings, 2 replies; 5+ messages in thread

From: Alvaro Herrera @ 2016-08-02 18:00 UTC (permalink / raw)
  To: hargudekishor@gmail.com; +Cc: pgsql-bugs

hargudekishor@gmail.com wrote:

> We have connected our node js application with postgresql-9.4.8.We have
> several functions which are getting created in database using async call
> from nodejs to postgresql server.but while creating those functions ,We are
> encountered a error of "Tuple concurrently updated".

Yeah, this is known.  We haven't worried too much, because the use case
seems thin: why are you deleting and creating the function over and
over?  Wouldn't it be better to create the function once and be done
with it?

> And because of this error our node js application is getting
> terminated.which is not affordable to us.

Surely the application should be able to do something else upon
receiving an error, rather than crashing.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
@ 2016-08-02 19:30  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 2016-08-02 19:30 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: hargudekishor@gmail.com; pgsql-bugs

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> hargudekishor@gmail.com wrote:
>> We have connected our node js application with postgresql-9.4.8.We have
>> several functions which are getting created in database using async call
>> from nodejs to postgresql server.but while creating those functions ,We are
>> encountered a error of "Tuple concurrently updated".

> Yeah, this is known.  We haven't worried too much, because the use case
> seems thin: why are you deleting and creating the function over and
> over?  Wouldn't it be better to create the function once and be done
> with it?

Note that each one of those create calls, before failing, will have had
to wait for the previous updater to commit or not.  We could imagine
installing alternate behavior such as "don't fail if the new state of the
pg_proc row is exactly what you wanted anyway"; but I do not see any
useful semantics that would not involve waiting to see if the prior
transaction commits.  And then there's the cost of the bloat that you're
creating in the pg_proc catalog.  So quite aside from the possibility of
a concurrent-update failure, you'd be much better off from a performance
standpoint if you take the trouble to not repetitively create the same
function.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
@ 2016-08-03 00:14  Michael Paquier <michael.paquier@gmail.com>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Michael Paquier @ 2016-08-03 00:14 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-bugs

On Wed, Aug 3, 2016 at 3:00 AM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> hargudekishor@gmail.com wrote:
>
>> We have connected our node js application with postgresql-9.4.8.We have
>> several functions which are getting created in database using async call
>> from nodejs to postgresql server.but while creating those functions ,We are
>> encountered a error of "Tuple concurrently updated".
>
> Yeah, this is known.  We haven't worried too much, because the use case
> seems thin: why are you deleting and creating the function over and
> over?  Wouldn't it be better to create the function once and be done
> with it?

Hm. These days I have been pinged regarding the fact that it is
possible to reach this error on a relation that has a lot of updates
and where autovacuum is made more aggressive. Well, it increases the
possibility to face it. simple_heap_delete() is not used except for
catalogs, so could it be related to one of the pg_stat catalogs
complaining with VACUUM ANALYZE running in parallel?

>> And because of this error our node js application is getting
>> terminated.which is not affordable to us.
>
> Surely the application should be able to do something else upon
> receiving an error, rather than crashing.

That's for sure. A crash is a bad idea, and I recall that this is not
a critical failure.
-- 
Michael


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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq
@ 2016-08-03 07:00  Kishor Hargude <hargudekishor@gmail.com>
  parent: Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Kishor Hargude @ 2016-08-03 07:00 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; Alvaro Herrera <alvherre@2ndquadrant.com>; pgsql-bugs; tgl@sss.pgh.pa.us

Hi,

Thanks everyone for your valuable inputs.

I got it now,The issue may be happening due to pg_proc catalog table update
for same function by different connection at the same time(due to async
call of  node js to multiple db connections for same functions creation ).


--
Kishor


On Wed, Aug 3, 2016 at 5:44 AM, Michael Paquier <michael.paquier@gmail.com>
wrote:

> On Wed, Aug 3, 2016 at 3:00 AM, Alvaro Herrera <alvherre@2ndquadrant.com>
> wrote:
> > hargudekishor@gmail.com wrote:
> >
> >> We have connected our node js application with postgresql-9.4.8.We have
> >> several functions which are getting created in database using async call
> >> from nodejs to postgresql server.but while creating those functions ,We
> are
> >> encountered a error of "Tuple concurrently updated".
> >
> > Yeah, this is known.  We haven't worried too much, because the use case
> > seems thin: why are you deleting and creating the function over and
> > over?  Wouldn't it be better to create the function once and be done
> > with it?
>
> Hm. These days I have been pinged regarding the fact that it is
> possible to reach this error on a relation that has a lot of updates
> and where autovacuum is made more aggressive. Well, it increases the
> possibility to face it. simple_heap_delete() is not used except for
> catalogs, so could it be related to one of the pg_stat catalogs
> complaining with VACUUM ANALYZE running in parallel?
>
> >> And because of this error our node js application is getting
> >> terminated.which is not affordable to us.
> >
> > Surely the application should be able to do something else upon
> > receiving an error, rather than crashing.
>
> That's for sure. A crash is a bad idea, and I recall that this is not
> a critical failure.
> --
> Michael
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2016-08-03 07:00 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 06:22 BUG #14273: Tuple concurently updated error while creating function using async call from node js with postgresq hargudekishor@gmail.com
2016-08-02 18:00 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2016-08-02 19:30   ` Tom Lane <tgl@sss.pgh.pa.us>
2016-08-03 00:14   ` Michael Paquier <michael.paquier@gmail.com>
2016-08-03 07:00     ` Kishor Hargude <hargudekishor@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox