Re: [HACKERS] Is SPI safe to use in multi-threaded PL/Java?
From: Tom Lane t...@sss.pgh.pa.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Is SPI safe to use in multi-threaded PL/Java?
From: Tom Lane t...@sss.pgh.pa.us MauMau maumau...@gmail.com writes: To put the question in other words, is it safe to load a multi-threaded PL library in the single-threaded backend process, if the PL only calls SPI in the main thread? 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. * SPI must not be used in multi-threaded process, even if only one thread calls SPI functions at a time. So what we can say is that PL/Java is not safe theoretically in terms of SPI. Regards MauMau -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Is SPI safe to use in multi-threaded PL/Java?
MauMau maumau...@gmail.com writes: From: Tom Lane t...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Is SPI safe to use in multi-threaded PL/Java?
MauMau maumau...@gmail.com writes: Is PL/Java safe to use in terms of its threading design? I'm going to ask the PL/Java community about this too, but I'd ask for opinions here because I believe people in this community have seasoned knowledge of OS and SPI. To put the question in other words, is it safe to load a multi-threaded PL library in the single-threaded backend process, if the PL only calls SPI in the main thread? When it breaks, we're not going to be concerned. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers