From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Daniel Schuchardt <daniel_schuchardt(at)web(dot)de> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: beta1 & beta2 & Windows & heavy load |
Date: | 2004-09-12 23:04:42 |
Message-ID: | 24365.1095030282@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Daniel Schuchardt <daniel_schuchardt(at)web(dot)de> writes:
> now I get
> ERROR: buffer XYZ is not owned by resource owner TopTransaction
Yeah, I ran into that earlier today while trying to reproduce your
problem. It's fixed by this pending patch. I didn't see any freeze-up
of the system after running out of lock memory, though. It seemed to
release the locks just fine.
*** src/pl/plpgsql/src/pl_exec.c.orig Sun Aug 29 22:58:09 2004
--- src/pl/plpgsql/src/pl_exec.c Sun Sep 12 17:04:30 2004
***************
*** 897,902 ****
--- 897,903 ----
* sub-transaction
*/
MemoryContext oldcontext = CurrentMemoryContext;
+ ResourceOwner oldowner = CurrentResourceOwner;
volatile bool caught = false;
int xrc;
***************
*** 907,918 ****
BeginInternalSubTransaction(NULL);
/* Want to run statements inside function's memory context */
MemoryContextSwitchTo(oldcontext);
if ((xrc = SPI_connect()) != SPI_OK_CONNECT)
elog(ERROR, "SPI_connect failed: %s",
SPI_result_code_string(xrc));
PG_TRY();
! rc = exec_stmts(estate, block->body);
PG_CATCH();
{
ErrorData *edata;
--- 908,922 ----
BeginInternalSubTransaction(NULL);
/* Want to run statements inside function's memory context */
MemoryContextSwitchTo(oldcontext);
+
if ((xrc = SPI_connect()) != SPI_OK_CONNECT)
elog(ERROR, "SPI_connect failed: %s",
SPI_result_code_string(xrc));
PG_TRY();
! {
! rc = exec_stmts(estate, block->body);
! }
PG_CATCH();
{
ErrorData *edata;
***************
*** 927,932 ****
--- 931,937 ----
/* Abort the inner transaction (and inner SPI connection) */
RollbackAndReleaseCurrentSubTransaction();
MemoryContextSwitchTo(oldcontext);
+ CurrentResourceOwner = oldowner;
SPI_pop();
***************
*** 958,965 ****
--- 963,973 ----
if ((xrc = SPI_finish()) != SPI_OK_FINISH)
elog(ERROR, "SPI_finish failed: %s",
SPI_result_code_string(xrc));
+
ReleaseCurrentSubTransaction();
MemoryContextSwitchTo(oldcontext);
+ CurrentResourceOwner = oldowner;
+
SPI_pop();
}
}
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Gaetano Mendola | 2004-09-12 23:16:09 | Re: pgindent vs try/catch |
Previous Message | Tom Lane | 2004-09-12 22:57:26 | Re: beta1 & beta2 & Windows & heavy load |