Re: beta1 & beta2 & Windows & heavy load - Mailing list pgsql-hackers

From Tom Lane
Subject Re: beta1 & beta2 & Windows & heavy load
Date
Msg-id 24365.1095030282@sss.pgh.pa.us
Whole thread Raw
In response to beta1 & beta2 & Windows & heavy load  (Daniel Schuchardt <daniel_schuchardt@web.de>)
Responses Re: beta1 & beta2 & Windows & heavy load
List pgsql-hackers
Daniel Schuchardt <daniel_schuchardt@web.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: beta1 & beta2 & Windows & heavy load
Next
From: Gaetano Mendola
Date:
Subject: Re: pgindent vs try/catch