db->put: Invalid argument?

Alex Kiernan alexk at demon.net
Tue Jul 10 07:56:39 UTC 2001


Ron Jarrell <jarrell at solaris.cc.vt.edu> writes:

> At 08:17 AM 7/9/01 +0100, Alex Kiernan wrote:
> 
> >
> >If you're willing to try I've some patches against Berkeley DB which I
> >hope will help to identify the problem.
> 
> So long as they won't eat my performance, I'd be willing to give it a shot.
> Might be a few days before I could schedule the time to recompile the library,
> rebuild INN, and swap it into place though.  Hasn't happened again since that
> second occurrence though.
> 

It shouldn't be too bad (its a getpid() per mutex lock & unlock). If
you do get it to fail, can you pick one of the blocked processes and
print out mutexp->lockedby & unlockedby. Then look and see if those
processes are still running & if so what they are.

There's no way this patch will help with the problem (but there is of
course the risk that it may alter the timing such that it happens even
less often), but hopefully it'll help point me in the right direction.

Index: include/mutex.h
===================================================================
RCS file: /cvsroot/upstream/bdb/include/mutex.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 mutex.h
--- include/mutex.h	2001/04/02 15:24:24	1.1.1.2
+++ include/mutex.h	2001/07/10 07:53:17
@@ -648,6 +648,8 @@
 #endif
 	u_int32_t spins;		/* Spins before block. */
 	u_int32_t locked;		/* !0 if locked. */
+	u_int32_t lockedby;
+	u_int32_t unlockedby;
 #else
 	u_int32_t off;			/* Byte offset to lock. */
 	u_int32_t pid;			/* Lock holder: 0 or process pid. */
Index: mutex/mut_pthread.c
===================================================================
RCS file: /cvsroot/upstream/bdb/mutex/mut_pthread.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 mut_pthread.c
--- mutex/mut_pthread.c	2001/04/02 15:24:25	1.1.1.2
+++ mutex/mut_pthread.c	2001/07/10 07:53:17
@@ -169,6 +169,9 @@
 	if (ret == 0)
 		F_SET(mutexp, MUTEX_INITED);
 
+	mutexp->lockedby = 0;
+	mutexp->unlockedby = 0;
+
 	return (ret);
 }
 
@@ -224,6 +227,7 @@
 #else
 		mutexp->locked = 1;
 #endif
+		mutexp->lockedby = getpid();
 		/*
 		 * According to HP-UX engineers contacted by Netscape,
 		 * pthread_mutex_unlock() will occasionally return EFAULT
@@ -255,6 +259,7 @@
 #else
 		mutexp->locked = 1;
 #endif
+		mutexp->lockedby = getpid();
 	}
 	return (0);
 }
@@ -285,6 +290,7 @@
 			return (ret);
 
 		mutexp->locked = 0;
+		mutexp->unlockedby = getpid();
 
 		if ((ret = pthread_cond_signal(&mutexp->cond)) != 0)
 			return (ret);
@@ -298,6 +304,7 @@
 			return (ret);
 	} else {
 		mutexp->locked = 0;
+		mutexp->unlockedby = getpid();
 
 		/* See comment above;  workaround for [#2471]. */
 		i = PTHREAD_UNLOCK_ATTEMPTS;


-- 
Alex Kiernan, Principal Engineer, Development, Thus PLC


More information about the inn-workers mailing list