Skip to content

Commit 7d355da

Browse files
authored
Fixed Increment of Retry Counts
Local variable 'retryCount' was never incremented in the save loop for methods ResetItemTimeout and ReleaseItemExclusive, causing the potential for an infinite loop.
1 parent 0e84fe3 commit 7d355da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Couchbase.AspNet/SessionState/CouchbaseSessionStateProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ public override void ReleaseItemExclusive(
399399
// Attempt to clear the lock for this item and loop around until we succeed
400400
e.LockId = 0;
401401
e.LockTime = DateTime.MinValue;
402-
} while (!e.SaveHeader(_bucket, id, _exclusiveAccess, out status) && retries < _maxRetryCount && status != ResponseStatus.KeyNotFound);
402+
} while (!e.SaveHeader(_bucket, id, _exclusiveAccess, out status) && retries++ < _maxRetryCount && status != ResponseStatus.KeyNotFound);
403403
}
404404

405405
/// <summary>
@@ -445,7 +445,7 @@ public override void ResetItemTimeout(
445445
}
446446

447447
// Try to save with CAS, and loop around until we succeed
448-
} while (!e.SaveAll(_bucket, id, _exclusiveAccess, out keyNotFound) && retries < _maxRetryCount && !keyNotFound);
448+
} while (!e.SaveAll(_bucket, id, _exclusiveAccess, out keyNotFound) && retries++ < _maxRetryCount && !keyNotFound);
449449
}
450450

451451
/// <summary>
@@ -483,4 +483,4 @@ public override bool SetItemExpireCallback(SessionStateItemExpireCallback expire
483483
* limitations under the License.
484484
*
485485
* ************************************************************/
486-
#endregion
486+
#endregion

0 commit comments

Comments
 (0)