phalcon/cphalcon · error · Phalcon\Session\Adapter\Exceptions\AdapterRuntimeError
Could not acquire the session lock with key
Error message
Could not acquire the session lock with key: {lockKey} What it means
Session locking failure in Redis session adapter: read() tried to acquire a per-session lock (lockingEnabled is true) but acquireLock() did not return true after retrying for lockRetryInterval over the lockWaitTime budget. Another request holds the lock for the same session id, or a stale lock was never released; instead of corrupting concurrent session data, the adapter aborts with this runtime error naming the lock key.
Solutions
- Ensure every request path releases the lock (destroy/close/releaseLock) so stale locks do not persist
- Increase the 'lockWaitTime' and/or 'lockRetryInterval' options for long-running requests
- Check for stuck/duplicated requests hitting the same session id (e.g. parallel AJAX calls)
- Inspect the Redis key for the lock and clear it manually if a crashed process left it behind
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at phalcon/Session/Adapter/Redis.zep:111 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/c3f406d70cc57b88.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Session/Adapter/Redis.zep:111
*/
public function destroy(string id) -> bool
{
var result;
let result = parent::destroy(id);
this->releaseLock();
return result;
}
/**
* Read
*/
public function read(string id) -> string
{
if (true === this->lockingEnabled && true !== this->acquireLock(id)) {
throw new AdapterRuntimeError(
"Could not acquire the session lock with key: " . this->lockKey
);
}
return parent::read(id);
}
/**
* Tries to acquire the session lock, pausing `lockWaitTime` microseconds
* between attempts, up to `lockRetries` times
*/
protected function acquireLock(string id) -> bool
{
var client, lockKey, result, token;
int attempt;
let lockKey = this->prefix . id . "-lock";
View on GitHub (pinned to b7419de9cd)