Skip to content

Commit 5d93866

Browse files
Fix regression when logging message after session concurrency is exceeded.
1 parent c2e6ed1 commit 5d93866

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Cm/RedisSession/Handler.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,21 @@ public function read($sessionId)
510510
// Limit concurrent lock waiters to prevent server resource hogging
511511
if ($waiting >= $this->_maxConcurrency) {
512512
// Overloaded sessions get 503 errors
513-
$this->_redis->hIncrBy($sessionId, 'wait', -1);
514-
$this->_sessionWritten = true; // Prevent session from getting written
515-
list($writes, $lockedRequestUrl) = $this->_redis->hMGet($sessionId, ['writes','req']);
513+
try {
514+
$this->_redis->hIncrBy($sessionId, 'wait', -1);
515+
$this->_sessionWritten = true; // Prevent session from getting written
516+
$sessionInfo = $this->_redis->hMGet($sessionId, ['writes','req']);
517+
} catch (Exception $e) {
518+
$this->_log("$e", LoggerInterface::WARNING);
519+
}
516520
$this->_log(
517521
sprintf(
518522
'Session concurrency exceeded for ID %s; displaying HTTP 503 (%s waiting, %s total '
519523
. 'requests) - Locked URL: %s',
520-
$sessionId, $waiting, $writes, $lockedRequestUrl
524+
$sessionId,
525+
$waiting,
526+
isset($sessionInfo['writes']) ? $sessionInfo['writes'] : '-',
527+
isset($sessionInfo['req']) ? $sessionInfo['req'] : '-'
521528
),
522529
LoggerInterface::WARNING
523530
);

0 commit comments

Comments
 (0)