Re: Is SPI safe to use in multi-threaded PL/Java? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Is SPI safe to use in multi-threaded PL/Java?
Date
Msg-id 11347.1394545919@sss.pgh.pa.us
Whole thread Raw
In response to Re: Is SPI safe to use in multi-threaded PL/Java?  ("MauMau" <maumau307@gmail.com>)
Responses Re: Is SPI safe to use in multi-threaded PL/Java?  ("MauMau" <maumau307@gmail.com>)
List pgsql-hackers
"MauMau" <maumau307@gmail.com> writes:
> From: "Tom Lane" <tgl@sss.pgh.pa.us>
>> When it breaks, we're not going to be concerned.

> I may not understand your nuance.  Which of the following do you mean?

> * PL/Java's design is dangerous in terms of the mixture of single- and 
> multi-threading, and we cannot be 100% sure whether there's really no 
> problem.

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.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: db_user_namespace a "temporary measure"
Next
From: Tom Lane
Date:
Subject: Re: db_user_namespace a "temporary measure"