Bug #69136 [Com]: Session file empty when session-path on NFS mount
| From: | sprunka at gmail dot com | Date: | Tue, 26 Jan 2016 18:19:20 +0000 |
| Subject: | Bug #69136 [Com]: Session file empty when session-path on NFS mount | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198908@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69136&edit=1
ID: 69136
Comment by: sprunka at gmail dot com
Reported by: maggus dot staab at googlemail dot com
Summary: Session file empty when session-path on NFS mount
Status: Feedback
Type: Bug
Package: Session related
Operating System: Ubuntu 14 LTS
PHP Version: 5.6.6
Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
Two separate vagrant VM instances.
1)
CentOS release 6.5 (Final)
PHP 5.6.17
Session save path is shared with host machine via vagrant default sync settings (not NFS, SMB,
RSync, or VirtualBox)
2)
CentOS release 6.7 (Final)
PHP 5.6.17 (Also tested with PHP 7 -- not sure which build, ame problem existed)
Session save path is shared with host machine via vagrant default sync settings (not NFS, SMB,
RSync, or VirtualBox) However, I have also tried this setup using the NFS sync type and it also
failed.
Previous Comments:
------------------------------------------------------------------------
[2016-01-17 07:39:23] yohgaki@php.net
Sorry for the delay, but I couldn't reproduce this on my Fedora23 and CentOS7.
"files" handler is working as it should.
Do you have this issue still? I think you have some kind of permission issue such as you are writing
session data by multiple user IDs. It wouldn't work with multiple user IDs or root ID.
------------------------------------------------------------------------
[2015-03-28 21:14:18] yohgaki@php.net
Locking under shared directory is unreliable. I guess this is the reason why.
Better approach to share sessions across servers is to use databases/caches like
memcached/mongodb/redis/etc.
Anyway, I may look into details...
------------------------------------------------------------------------
[2015-02-27 11:08:28] me at kelunik dot com
Same thing happens with a NTFS partition mounted with under Ubuntu 14.10
ntfs defaults,umask=0000,permissions,uid=1000 0 0.
------------------------------------------------------------------------
[2015-02-27 10:59:29] maggus dot staab at googlemail dot com
1) I dont understand why the session cannot be written, since I checked is_dir, is_writable and
is_readable beforehand. Even setting the dir to "0777" makes it work.
2) when basic things like writing a session doesnt work, I would expect a ERROR instead of a WARNING
------------------------------------------------------------------------
[2015-02-27 10:56:47] maggus dot staab at googlemail dot com
Description:
------------
php -v
PHP 5.6.5-1+deb.sury.org~trusty+1
Test script:
---------------
<?php
$path = '/path/to/a/dir/mounted/via/nfs/';
if (!is_dir($path) || !is_writable($path) || !is_readable($path)) {
throw new Exception("$path is not a proper dir");
}
//ini_set("session.save_path", $path); // neither this works
session_save_path($path); // nor this does
session_start();
$_SESSION['cnt'] = $_SESSION['cnt']+1;
var_dump($_SESSION['cnt']);
if ($_SESSION['cnt'] > 1) {
echo "<h1>WORKS</h1>";
session_destroy();
}
exit();
Expected result:
----------------
on each 2nd request "WORKS" is printed.
Actual result:
--------------
session is not persisted. session file gets created but does not contain any content. therefore
subsequent calls will never echo "WORKS" because session cannot be continued.
with default Ubuntu php.ini a error/warning doesnt show up at all.
After adding
ini_set("display_errors", "On");
error_reporting(E_ALL);
I get a warning
"Warning: Unknown: Failed to write session data (files). Please verify that the current setting
of session.save_path is correct (/XX..ZZ..YY/tmp/www/session/) in Unknown on line 0"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69136&edit=1