Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

session_write_close(): Failed to write session data using user defined save handler. #77

Open
intellent opened this issue May 19, 2017 · 6 comments

Comments

@intellent
Copy link

Occasionally,we get the following not yet reproducible warning:

WARN: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: ) {"errno":2,"file":"/var/www/html/vendor/zendframework/zend-session/src/SessionManager.php","line":229}

This is how we initialize the session:

// Load config
$config = $serviceManager->get('Config');

// Initialize session
$sessionConfig = new SessionConfig();
$sessionConfig->setOptions($config['session']);

$sessionTableGateway = new TableGateway('session', $serviceManager->get('Zend\Db\Adapter\Adapter'));
$saveHandler = new DbTableGateway($sessionTableGateway, new DbTableGatewayOptions());

$sessionManager = new SessionManager($sessionConfig, null, $saveHandler);
$sessionManager->setName($config['session']['name']);

$sessionManager->start();

Container::setDefaultManager($sessionManager);
@cg923
Copy link

cg923 commented Feb 20, 2018

I am facing a similar issue since upgrading to PHP 7.1 . I should note though, that we are using a VERY old version of Zend Framework: 1.10.

I do notice though that your session.save_path seems to be empty?
(session.save_path: )
There should probably be something there like /var/lib/php/session

@apoca
Copy link

apoca commented Sep 11, 2018

Yes, I am facing exactly the same issue here. I am using also the session-db, i don't know why he reproduces this error pointing to something like if was saved on local disk.

captura de ecra 2018-09-11 as 11 54 04

@jamelcity
Copy link

jamelcity commented Sep 18, 2018

I'm also experienced the same issue but my particularity is that the session save handler want well to store user id (after logging) but doesn't want to store data session cart to sessiondb

@Nguimjeu
Copy link

🤔 I'm facing the exact same issue when I use Zend\Cache\Storage\Adapter\BlackHole::class as save handler

@jonathanmaron
Copy link
Contributor

jonathanmaron commented Dec 13, 2019

I also occasionally experience the error (E_WARNING):

session_write_close(): Failed to write session data using user defined save handler. 
(session.save_path: /var/lib/php/sessions)

in src/SessionManager.php on line 234.

What is interesting is that I am using Zend\Session\SaveHandler\DbTableGateway as a SaveHandler.

The session with the session ID included in the error log is not stored in the database.

The error happens sporadically and is not reproducible.

I am using zend-session 2.9.1.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-session; a new issue has been opened at laminas/laminas-session#6.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants