-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot call session save handler in a recursive manner" #5545
Comments
3.18 doesn't have the issue. |
I have the same problem |
If you comment/remove the function
I didnt debugged it deeper, but i think the validate-function dont work correctly, when it get called async. Edit: Rename the function |
What PHP version is this on? Using which session driver? |
files driver |
Files 7.2.1 |
@Xcreen and you? |
My solution probably resolve this problem. |
No, #5550 doesn't resolve anything. Anyway, I assume @Xcreen has no intention of replying or is just unavailable, but he did stumble upon a clue ...
Yet, So, a logical solution should be to rename diff --git a/system/libraries/Session/Session_driver.php b/system/libraries/Session/Session_driver.php
index 2fe30b8..a26b3a3 100644
--- a/system/libraries/Session/Session_driver.php
+++ b/system/libraries/Session/Session_driver.php
@@ -121,7 +121,7 @@ abstract class CI_Session_driver implements SessionHandlerInterface {
*/
public function php5_validate_id()
{
- if (PHP_VERSION_ID < 70000 && isset($_COOKIE[$this->_config['cookie_name']]) && ! $this->validateId($_COOKIE[$this->_config['cookie_name']]))
+ if (isset($_COOKIE[$this->_config['cookie_name']]) && ! $this->validateSessionId($_COOKIE[$this->_config['cookie_name']]))
{
unset($_COOKIE[$this->_config['cookie_name']]);
}
diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php
index 074accf..f342690 100644
--- a/system/libraries/Session/drivers/Session_database_driver.php
+++ b/system/libraries/Session/drivers/Session_database_driver.php
@@ -353,7 +353,7 @@ class CI_Session_database_driver extends CI_Session_driver implements SessionHan
* @param string $id
* @return bool
*/
- public function validateId($id)
+ public function validateSessionId($id)
{
// Prevent previous QB calls from messing with our queries
$this->_db->reset_query();
diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php
index 654f300..8c7fac0 100644
--- a/system/libraries/Session/drivers/Session_files_driver.php
+++ b/system/libraries/Session/drivers/Session_files_driver.php
@@ -402,7 +402,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle
* @param string $id
* @return bool
*/
- public function validateId($id)
+ public function validateSessionId($id)
{
return is_file($this->_file_path.$id);
}
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index 9e81168..b464439 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -303,7 +303,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
* @param string $id
* @return bool
*/
- public function validateId($id)
+ public function validateSessionId($id)
{
$this->_memcached->get($this->_key_prefix.$id);
return ($this->_memcached->getResultCode() === Memcached::RES_SUCCESS);
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index d7a5755..f351aff 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -323,7 +323,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
* @param string $id
* @return bool
*/
- public function validateId($id)
+ public function validateSessionId($id)
{
return (bool) $this->_redis->exists($this->_key_prefix.$id);
} Can you all confirm that this works for you? |
FYI, regardless of how it looks like, this has nothing to do with AJAX requests, flash data, (a)synchronicity or anything ... those things just happen to be a trigger in your cases (@digitaloutback, @it-can). |
Cool I’ll test it tomorrow! |
I checked the solution you proposed. It doesn't work in my case. I have PHP 5.6.34 |
@narfbg the fix is also not working for me... But when i use this
Also I found that commenting out --EDIT-- When commenting out |
Ok, now this is getting really bizzare ... @dkowalskidev Does it only now not work on 5.6 or did you have the original issue on 5.6 as well? Also, are you getting the same error messages as @it-can and @digitaloutback? @it-can Still the same error messages? And can you check what |
@narfbg Yes, I have the same message error. My issue was on 5.6. When I use |
@narfbg same errors still... |
Mmm found something else... https://github.com/bcit-ci/CodeIgniter/blob/3.1-stable/system/libraries/Session/Session.php#L108 If i change this:
to this:
it works again... weird huh... |
|
@dkowalskidev yeah 5.4 and up Can you test this also? |
@it-can Yes, it still doesn't work. |
Mmm weird for me it does |
That change to the Still no reply on what the |
On a similar note, does |
clearstatcache(TRUE) does not work for me. file_exists() && ! is_dir() does also not work for me permission are
I cannot seem to get a response of is_file() when it fails... Fix suggested in #5550 seems to work though |
What do you mean you can't get a response from According to the error messages, the crash occurs during |
@narfbg it seems it never reaches that point when the request / session fails, all other requests it returns true |
@narfbg if I add |
hello, |
@mimoza39 also please try my suggestion, to see if it works...
|
hello |
@it-can Well, this still doesn't make sense for a number of reasons, but I guess we're getting somewhere. If the
And I still do need the value of |
@narfbg works for me :-) $result = true |
@narfbg it works in my case too |
Sorry for the late reply, i was on larger trip the last month and didnt checked my github. |
Just to add another data point on this issue. After making these changes, the old session files were correctly removed, but I started to see the error discussed in this thread appearing in my logs. The error never appeared before I made these changes. I'll try the fix suggested here and let you know if it works for me. |
Problem is |
Its also related to the garbage collection. If the session garbage collector is turned off then the error doesn't occur. I guess the garbage collector deletes the session file without clearing the stat cache for that file. The suggested fix does work. So does turning off the session garbage collection and deleting the old session files via a cronjob (as suggested in the php.net docs) |
@webalchemist are you sure about getting error: Or your error is smth like this: First error is 100% endless loop: during multiple script calls session data is changed and is less than it was -> |
Thank you @killradio this solved our problems! |
@killradio It was definitely the first error (max execution time @ Session_files_driver.php 212). Searching for that error is how I found this thread. As I said, the clearstatcache() patch does resolve the issue, but so (for me) did turning off the PHP session garbage collection. initially I had session.gc_probability = 0 - no error |
PERUBAHAN INI DIPERLUKAN UNTUK NGATASIN PERUBAHAN CABANG DAN PERUBAHAN TOKO (MANAJEMEN CABANG DAN TOKO) KARENA SEJAUH INI NYANGKUT TERUS DAN HAL TERSEBUT DISEBABKAN KARENA RECURSIVE SESSION DARI CODEIGNITERNYA. REFRENSI :bcit-ci/CodeIgniter#5545
I am getting a timeout in
Session_files_driver.php
with these in my logs:What I am doing:
Additional info:
I have separated out the barebones setup of this in a new 3.19 and zipped up here to see, just hit the form submit on the form field on the welcome view.
https://www.dropbox.com/s/2mbkdp1cdhftafj/ci-issue.zip?dl=0
The text was updated successfully, but these errors were encountered: