Session: Error while trying to free lock for ci_session |
I have reviewed the other few posts related to this error:
Session: Error while trying to free lock for ci_session and cannot figure out the problem. Our site isn't even close to taking 5 seconds for page loads, in fact they are typically 500ms. Therefore, any other ideas on how to troubleshoot? As a followup to this I configured memcached (the session driver we are using) to NOT use file locking. I confirmed this with a phpinfo page. Even after turning off file locking I still get this message.
Changing php.ini settings won't change anything.
Which CI version are you using? If it's not the latest, upgrade to it.
I have the same issue.
Our site is hosted on AWS and we have ELB with 5 servers behind. Yesterday we upgraded CI on 3.0.6 version. We are using memcached for handling sessions. In php.ini session handler is setup for memcached . When I try to use CI with memcached site is loading forever. But when I setup CI for using files the site is loading normally but have some weird issues. For example on one page is fine but when I click on the other I have been logout or even use some previous users which I was logged in. What should I do to make this work as it is supposed to work. Thanks
I have the same issue with the Redis driver and am also using CI 3.06 on AWS Elastic Beanstalk: http://forum.codeigniter.com/thread-64854.html
Session library is autoloaded and I am calling session_write_close where applicable.
@spojoneze,
maybe someone will eventually provide solution or creators will make this work in next version(s). This is ridiculous, response time with memcached is 5s - 6s, when move to files (php.ini session handler memcached) response is 100ms.. But with files it just logout users from time to time, sometimes in 10 minutes sometimes after 3 clicks on site... In CI 2 it worked like a charm with same server configuration.. It is really annoying
Are you calling session_write_close after you're finished writing session data? It won't fix the error but it will speed pages up considerably.
Thanks spjonez,
but I don get it, where to call session_write_close() ? For example I am having this in MY_Controller in __construct: PHP Code: if(isset($this->session->userdata["user_id"])){ PHP Code: if (isset($this->session->userdata["notifications"]["budget"])) { Also my app is heavily depends on AJAX calls. I tried in __desctruct function of MY_Controller to add session_write_close() but with no success. Beside this I have on numerous places in app where I do echo like this: PHP Code: <?php echo $this->session->userdata["lang"];?>
In any controller method after you're finished writing session data. You can still get session data after you've called session_write_close but you can't modify it.
Code: <?php if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' ); |
Welcome Guest, Not a member yet? Register Sign In |