-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Session Write Failed #15037
Comments
Could be #9438 related. |
Do you write any additional data into database? |
Thanks for posting in our issue tracker.
Thanks! This is an automated comment, triggered by adding the label |
It also writes the user ID to the session table on log in to be able to invalidate all of the user's sessions. |
Try code from master along with debug mode. It will reveal real reason behind the error. |
Try what from the master branch? I have looked in at the debugger. That's how I got the stack trace, because I had already refreshed. The stack trace says |
Well, the reason. In 2.0.12 you'll see this error. In master you may see, for example, an exception that occurred during saving values to DB with your custom handler that resulted in |
I use this for the the session module config to include the user ID.
|
I'd check if user isn't guest here first. |
I've gone ahead and added a ternary to set the user ID or explicitly set null, but I'm still not sure if that's what caused the issue; since if the user is not signed in that would be null anyway. Like I said, though. That's the first time that happened and it only happened once. So it's hard to say, but I added checking it anyway per your recommendation. |
I'm closing the issue for now since there's not enough info to fix anything. If it will appear again, please let us know. |
What steps will reproduce the problem?
Couldn't say this was the first time it happened and it happened only once on page reload - reloading a second time had no issue.
What is the expected result?
Session writes to the DB
What do you get instead?
Session write failed
Additional info
yii\base\ErrorException: session_regenerate_id(): Session write failed. ID: user (path: ) in /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/Session.php:295 Stack trace: #0 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/DbSession.php(103): yii\web\DbSession->regenerateID() #1 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/User.php(618): yii\web\DbSession->regenerateID() #2 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/User.php(292): app\components\User->switchIdentity() #3 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/User.php(674): app\components\User->loginByCookie() #4 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/User.php(188): app\components\User->renewAuthStatus() #5 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/User.php(343): app\components\User->getIdentity() #6 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/Component.php(132): app\components\User->getId() #7 /Users/KnightYoshi/workspace/www/site_project/modules/randimg/views/randimg/viewset.php(14): app\components\User->__get() #8 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/View.php(330): app\components\View->unknown() #9 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/View.php(250): app\components\View->renderPhpFile() #10 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/View.php(152): app\components\View->renderFile() #11 /Users/KnightYoshi/workspace/www/site_project/components/View.php(58): app\components\View->render() #12 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/Controller.php(381): app\components\View->render() #13 /Users/KnightYoshi/workspace/www/site_project/modules/randimg/controllers/RandimgController.php(158): app\modules\randimg\controllers\RandimgController->render() #14 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/InlineAction.php(57): app\modules\randimg\controllers\RandimgController->actionDisplay() #15 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/InlineAction.php(57): ::call_user_func_array:{/Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/InlineAction.php:57}() #16 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams() #17 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/Module.php(523): app\modules\randimg\controllers\RandimgController->runAction() #18 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/web/Application.php(102): yii\web\Application->runAction() #19 /Users/KnightYoshi/workspace/www/site_project/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest() #20 /Users/KnightYoshi/workspace/www/site_project/web/index.php(12): yii\web\Application->run() #21 {main}
The text was updated successfully, but these errors were encountered: