[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: back-bdb resource leak (ITS#2040)



I have tested the suggested patch and it fixes the resource leak. Here is the
diff against db-4.0.14; a corresponding change also works for the 4.1
pre-release.

--- db_cam.c	2002/08/27 17:49:34	1.1
+++ db_cam.c	2002/08/27 17:51:42
@@ -803,6 +803,9 @@
 		 * opd if we went to another key.
 		 */
 		if (opd != NULL) {
+			if (cp_n->opd != NULL &&
+			    (ret = opd->c_close(cp_n->opd)) != 0)
+			    	goto err;
 			cp_n->opd = opd;
 			opd = NULL;
 		}


  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

-----Original Message-----
From: Keith Bostic [mailto:bostic@sleepycat.com]
Sent: Tuesday, August 27, 2002 8:24 AM
To: hyc@highlandsun.com
Cc: kurt@openldap.org; support@sleepycat.com
Subject: Re: BDB 4.0.14 locker leak [#6520]


Hi, my name is Keith Bostic and I'm with Sleepycat Software.
I'll own your Support Request for now.

> We have a DB_HASH database with sorted duplicates. When retrieving key/data
> using a cursor and DB_MULTIPLE, a locker ID is leaked if we have to loop
thru
> the retrieval process (because our passed in buffer is too small to contain
> all the data items in one pass).

I agree with you that this is a bug in Berkeley DB.  I have a
workaround to give you, but I'm not confident it's the correct
fix.  I will let you know as soon as the we know what change
we will be making to our source tree, and that change has been
reviewed and tested.

Thanks for finding this one!

Regards,
--keith

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Keith Bostic
Sleepycat Software Inc.		bostic@sleepycat.com
118 Tower Rd.			+1-781-259-3139
Lincoln, MA 01773		http://www.sleepycat.com



Index: db_cam.c
===================================================================
RCS file: /b/CVSROOT/db/db/db_cam.c,v
retrieving revision 11.113
diff -c -r11.113 db_cam.c
*** db_cam.c	2002/08/27 15:19:53	11.113
--- db_cam.c	2002/08/27 15:20:29
***************
*** 836,841 ****
--- 836,844 ----
  		 * key.
  		 */
  		if (opd != NULL) {
+ 			if (cp_n->opd != NULL &&
+ 			    (ret = opd->c_close(cp_n->opd)) != 0)
+ 				goto err;
  			cp_n->opd = opd;
  			opd = NULL;
  		}
***************
*** 866,872 ****
  		if ((t_ret = __db_c_cleanup(
  		    dbc_arg->internal->opd, opd, ret)) != 0 && ret == 0)
  			ret = t_ret;
-
  	}

  	if ((t_ret = __db_c_cleanup(dbc_arg, dbc_n, ret)) != 0 && ret == 0)
--- 869,874 ----