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

(This post was last modified: 02-23-2015, 05:43 AM by Nichiren.)

I've recently upgraded to 3.0 in production. I receive a hundred or so of these errors in the logs each day (I have around 20,000 actively logged in users at any given time. A few pages have a light sprinkling of user-initiated AJAX):

Session: Error while trying to free lock for ci_session
Session: Unable to obtain lock for ci_session

My config.php:
PHP Code:
$config['sess_driver'] = 'redis';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 604800// 1 week
$config['sess_save_path'] = 'tcp://remote_redis_ip:6379';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 1800;
$config['sess_regenerate_destroy'] = FALSE

To be clear, I prefer this to 2.x's non-locking implementation of sessions which was probably the cause of hours of grief when I was working on weird session issues that users were reporting. It seems from the documentation that calling session_write_close() within my application could potentially reduce these occurrences (I'm assuming it's because it's releasing the lock on the session earlier in the request).

My question is where is the best place for me to call it? I don't modify the session anywhere in the application after the user is logged in so I figure to call it in each controller's constructor like so:

PHP Code:
function __construct() {
 
   parent::__construct();
 
   session_write_close();


Am I on the right track here?
Reply


Messages In This Thread
Session: Error while trying to free lock for ci_session - by Nichiren - 02-22-2015, 03:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB