Re: plperlu stored procedure seems to freeze for a minute

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: plperlu stored procedure seems to freeze for a minute
Date: 2015-12-01 20:04:17
Message-ID: 20151201200417.GE30061@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2015-12-01 13:13:27 -0500, Tom Lane wrote:
> "Peter J. Holzer" <hjp-pgsql(at)hjp(dot)at> writes:
> > Postgres worker processes are single-threaded, are they? Is there
> > something else which could interact badly with a moderately complex
> > multithreaded I/O library used from a stored procedure?
>
> Yes, lots. If you cause additional threads to appear inside a backend
> process, things could break arbitrarily badly. It's up to you to ensure
> that none of those extra threads ever escape to execute any non-Perl
> code.

Actually, non-MQ code. Perl doesn't like to be unexpectedly
multithreaded either. Yes, those threads should only ever execute code
from the MQ library. In fact they are automatically created and
destroyed by the library and there is no way to control them from Perl
code (there may be a way to do that from the C API, but I don't remember
seeing that in the manual).

> I suspect this could easily explain the problems you're seeing.

Quite.

hp

--
_ | Peter J. Holzer | I want to forget all about both belts and
|_|_) | | suspenders; instead, I want to buy pants
| | | hjp(at)hjp(dot)at | that actually fit.
__/ | http://www.hjp.at/ | -- http://noncombatant.org/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roxanne Reid-Bennett 2015-12-01 21:48:02 Re: XID wraparound with huge pg_largeobject
Previous Message Peter J. Holzer 2015-12-01 19:55:02 Re: plperlu stored procedure seems to freeze for a minute