Welcome Guest, Not a member yet? Register   Sign In
Session: Error while trying to free lock for ci_session
#40

(This post was last modified: 05-26-2016, 11:57 AM by spjonez.)

(05-26-2016, 10:51 AM)Narf Wrote: Are you reading the same documentation? Nitpicky and possibly irrelevant, but the one I'm reading here says nothing about failures - 0 is rather an "I deleted 0 keys" count. Smile
I may be trying to read between the lines while there's nothing there to read, but if you're not reading the same docs, you may also not be using the same extension ...

Other than that, it is bizzare that delete() would return 0 while still deleting a key, and I see no logic in returning 0 for keys with expiry time, but ... you'd have to verify that. As I said previously - I don't have a Redis instance to test with.

There is the chance of a phpredis bug, especially if you're not using the same extension, or not the latest version.

Either way, that doesn't explain how the exact same issue would be triggered with Memcached too. Unless phpredis has copied code straigh from the memcached extension, that's almost an unimaginable coincidence.

I'm using phpredis 2.2.7 the latest release available: https://github.com/phpredis/phpredis/releases

Documentation I'm reading: https://github.com/phpredis/phpredis#del-delete

Exists shows the key exists, delete returns 0, exists then shows it does not. I'm not sure what to make of that unless it's expiring between the two calls which seems unlikely.

I'm not using Memcache nor have I tried it at any point so I can't comment on issues with that library.

This makes the error disappear but is probably not the way to solve it:

Code:
    protected function _release_lock()
    {
        if (isset($this->_redis, $this->_lock_key) && $this->_lock)
        {
            if ( ! $this->_redis->delete($this->_lock_key) && $this->_redis->exists($this->_lock_key))
            {
                log_message('error', 'Session: Error while trying to free lock for '.$this->_lock_key);
                return FALSE;
            }

            $this->_lock_key = NULL;
            $this->_lock = FALSE;
        }

        return TRUE;
    }

I posted this as an issue on phpredis's Github page to see if I can get clarification on deleting keys set to expire: https://github.com/phpredis/phpredis/issues/816
Reply


Messages In This Thread
RE: Session: Error while trying to free lock for ci_session - by spjonez - 05-26-2016, 11:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB