Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id A7A102E0048 for ; Mon, 14 Apr 2008 12:23:55 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 32976-08 for ; Mon, 14 Apr 2008 12:23:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by developer.postgresql.org (Postfix) with SMTP id 9B7EE2E002F for ; Mon, 14 Apr 2008 12:23:47 -0300 (ADT) Received: (qmail 24847 invoked by uid 1112); 14 Apr 2008 15:23:46 -0000 Date: Mon, 14 Apr 2008 11:23:46 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Alexander =?iso-8859-1?Q?W=F6hrer?= cc: pljava-dev@pgfoundry.org, pgsql-hackers@postgresql.org Subject: Re: [Pljava-dev] stack depth limit exceeded - patch possible? In-Reply-To: <58782.88.116.137.78.1208177811.squirrel@www.par.univie.ac.at> Message-ID: References: <48010499.30000@par.univie.ac.at> <58782.88.116.137.78.1208177811.squirrel@www.par.univie.ac.at> MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 200804/937 X-Sequence-Number: 117030 On Mon, 14 Apr 2008, Alexander W=F6hrer wrote: > am I understanding this correctly that pl/java sets it for the main Java > thread, so other threads spawned by this main thread and using postgres > SPI functionality will run into stack_depth_problems? pljava sets the stack_base_ptr for each thread just before it calls into=20 the backend using SPI and resets it when that thread finishes using SPI.=20 Only one thread can access the backend at a time, so multi-threaded pljava= =20 code is safe and this mangling of the stack_base_ptr keeps the backend=20 happy. > Can you suggest another workaround? > Are you having any actual problems or is this all theoretical? I don't=20 believe you should be having any issues, but if you're having a real=20 problem, please post a self-contained test case so we can look into it. Kris Jurka=