CodeIgniter: "Cannot call session save handler in a recursive manner"
I am getting a timeout in Session_files_driver.php
with these in my logs:
Severity: Error --> Maximum execution time of 30 seconds exceeded /system/libraries/Session/drivers/Session_files_driver.php 212
Severity: Warning --> Unknown: Cannot call session save handler in a recursive manner Unknown 0
Severity: Warning --> Unknown: Failed to write session data using user defined save handler. (session.save_path: /tmp/php) Unknown 0
What I am doing:
- A view contains a form that posts data to one controller
- The same view performs 2 asynchronous ajax calls to separate and different controllers when dom ready.
- No problem so far
- Data is posted from the form to controller
- This controller, when detects the post, sets some flashdata and redirects back to same method
- When hitting the view again from the redirect, only one ajax call is fired, the other hangs and hits the errors above.
Additional info:
- Removing one ajax call, the operation is fine and it doesn’t matter which one is removed.
- Removing the set flash data, things are fine
- Removing the redirect, things are fine
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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 42 (24 by maintainers)
Commits related to this issue
- Merge pull request #5563 from it-can/fix5545 fix #5545 — committed to bcit-ci/CodeIgniter by narfbg 6 years ago
- [ci skip] Changelog entry for #5545, PR #5563 — committed to bcit-ci/CodeIgniter by narfbg 6 years ago
- WARNING PERUBAHAN DALAM FOLDER SYSTEM CODEIGNITER PERUBAHAN INI DIPERLUKAN UNTUK NGATASIN PERUBAHAN CABANG DAN PERUBAHAN TOKO (MANAJEMEN CABANG DAN TOKO) KARENA SEJAUH INI NYANGKUT TERUS DAN HAL TERS... — committed to joshuanatan/indotama by deleted user 4 years ago
Problem is
filesize
return cached result (system/libraries/Session/drivers/Session_files_driver.php:210
).clearstatcache();
before this line -> solves this issue, thx @it-can.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 …
validateId()
is supposed to be auto-called by PHP 7+ only if the handler implementsSessionUpdateTimestampHandlerInterface
, which it doesn’t because that’s fucking ridiculous, poorly documented and I’d told the guy who wrote that logic that it’s a bad idea, but he listens to nobody but the voices in his head.The security researchers who reported the issue that warranted b3f7aae1079e8e484437bc67f4c126f34e7903d8 were supposed to verify it, and they didn’t catch that either.
Yet,
validateId()
is somehow being auto-called and triggering those errors. The messages are confusing because that’s what tends to happen when the bug is in PHP itself and it somehow doesn’t straight-up crash with a segmentation fault.So, a logical solution should be to rename
validateId()
to something else and then drop the version checks so that CI always calls it:Can you all confirm that this works for you?