Re: Is SPI safe to use in multi-threaded PL/Java?

From: "MauMau" <maumau307(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is SPI safe to use in multi-threaded PL/Java?
Date: 2014-03-12 11:16:00
Message-ID: 3E82FCBA4F7242FB826536A8B6390945@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> That, more or less. There is exactly zero provision in the Postgres
> code for multiple threads to exist inside a backend process. It's
> possible that PL/Java manages to completely insulate the Java world
> from the C world, so that the C code never sees more than one thread.
> But any leakage at all in that abstraction is probably going to cause
> bugs; and as I said, we (PG hackers) are not going to consider such
> bugs to be our problem.
>
> On platforms where the standard libc supports threading (which is most,
> these days), I'd be particularly worried about leakage along the path
> java -> libc -> postgres. If libc becomes aware that there are multiple
> threads executing inside the process, it's likely to change behaviors.

I see... even Tom-san is suspicious about the PL/Java's design, or the use
of SPI from code linked with libpthread.so. I'll communicate this to the
PL/Java community.

Regards
MauMau

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-03-12 12:05:57 Re: Torn page hazard in ginRedoUpdateMetapage()
Previous Message MauMau 2014-03-12 11:09:47 Re: [bug fix] pg_ctl always uses the same event source