From: Tom Lane Date: Fri, 8 Apr 2005 03:43:54 +0000 (+0000) Subject: Use an always-there test, not an Assert, to check for overrun of X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=94d9705c3e4378ec2c837149c882c86612e8d80c;p=users%2Fbernd%2Fpostgres.git Use an always-there test, not an Assert, to check for overrun of the held_lwlocks[] array. Per Qingqing Zhou. --- diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index 419ad21992..438f4f4d3b 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -328,7 +328,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode) SpinLockRelease_NoHoldoff(&lock->mutex); /* Add lock to list of locks held by this backend */ - Assert(num_held_lwlocks < MAX_SIMUL_LWLOCKS); + if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS) + elog(ERROR, "too many LWLocks taken"); held_lwlocks[num_held_lwlocks++] = lockid; /* @@ -397,7 +398,8 @@ LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode) else { /* Add lock to list of locks held by this backend */ - Assert(num_held_lwlocks < MAX_SIMUL_LWLOCKS); + if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS) + elog(ERROR, "too many LWLocks taken"); held_lwlocks[num_held_lwlocks++] = lockid; }