agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Multithreading
Date: Wed, 22 Feb 2006 08:49:47 +0100
Message-ID: <43FC179B.9000005@tada.se> (raw)
In-Reply-To: <802147018@web.de>
References: <802147018@web.de>
Patrick Peisker wrote:
> Problems:
>
> - Call a webservice from the thread: On creating an axis service object the jvm hangs up and the database automatically shut downs and restart!
>
> Any ideas?
>
>
The PostgreSQL backend is inherently single-threaded and this puts some
limitations on PL/Java. The PL/Java classloader uses the backend SPI
layer to load its classes. Consider the following scenario:
1. Your request gets served appropriately and something is put in the queue.
2. The Java call that the PostgreSQL backend issued returns and the
backend does other things.
3. The JVM decides to do some work in another thread and that causes a
class to be loaded.
When 3 occurs, you suddenly have 2 threads (the main thread that 'does
other things' and the new Java thread) attempting access to the backend
simultaneously. This will cause the Java thread to wait. And it will
remain waiting until the next call that goes into the Java domain
arrives from the backend (there's of course no guarantee such a call
will ever arrive). The current workaround for this problem is to ensure
that all needed classes are loaded in the main thread prior to the
return from the call.
This scenario can be perceived as a hung JVM but I've never seen it
result in automatic shutdown (not with the 1.2 release anyway). In order
to help, I must know what versions are you using (PL/Java, PostgreSQL,
JVM, and OS) and whats logged in the backend when the shutdown occurs.
Kind Regards,
Thomas Hallgren
view thread (4+ messages) latest in thread
Message-ID: <43FC179B.9000005@tada.se>
Permalink: ../43FC179B.9000005@tada.se/
Also on: postgresql.org/message-id/43FC179B.9000005@tada.se
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] Multithreading
In-Reply-To: <43FC179B.9000005@tada.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox