Re: plperlu stored procedure seems to freeze for a minute

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: plperlu stored procedure seems to freeze for a minute
Date: 2015-12-03 01:07:55
Message-ID: 565F95EB.1000205@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/2/15 9:26 AM, Peter J. Holzer wrote:
> As explained in backend/utils/misc/timeout.c, the timers are never
> cancelled: If a timeout is cancelled, postgres just sees that it has
> nothing to do and resumes whatever it is doing.

Hrm, if those timers are really just for auth purposes then perhaps they
should be cancelled. But aside from that, there's certainly other things
that can signal a backend (including fairly normal things, like DDL).
Offhand I don't think functions run in a CRITICAL block (and I don't
think it'd be a good idea for them to). So really, functions have to be
handle being interrupted.

> This is also what I'm seeing: 60 seconds after start, the process
> receives a SIGALRM.
>
> If the process is idle or in a "normal" SQL statement at the time, thats
> not a problem. But if it is in one of my stored procedures which is
> currently calling a ØMQ function which is waiting for some I/O
> (zmq_msg_recv(), most likely), that gets interrupted and returns an
> error which my code doesn't know how to handle (yet). So the error gets
> back to the user.

Yeah, it'd be nice to detect that this had happened. Or maybe it's worth
it to ignore SIGALARM while a UDF is running. (We certainly wouldn't
want to do a HOLD_INTERRUPTS() though...)
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-12-03 01:11:26 Re: json indexing and data types
Previous Message Merlin Moncure 2015-12-03 01:06:34 json indexing and data types