php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71349 Garbage collection not running
Submitted: 2016-01-12 11:03 UTC Modified: 2016-08-30 10:19 UTC
From: yunosh@php.net Assigned: yunosh (profile)
Status: Closed Package: Session related
PHP Version: master-Git-2016-01-12 (Git) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yunosh@php.net
New email:
PHP Version: OS:

 

 [2016-01-12 11:03 UTC] yunosh@php.net
Description:
------------
Looks like the GC settings don't work properly, or GC doesn't work at all on 7.1.0-dev.

Test script:
---------------
ini_set('session.gc_probability', 100);
ini_set('session.gc_divisor', 1);
ini_set('session.gc_maxlifetime', -1);
session_name('sessionname');
@session_start();


Expected result:
----------------
All sessions should be GC'ed

Actual result:
--------------
They aren't.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-12 12:00 UTC] yunosh@php.net
Test with unit tests:

$ sudo pear -d auto_discover=1 install -o -f channel://pear.horde.org/Horde_SessionHandler channel://pear.horde.org/Horde_Db channel://pear.horde.org/Horde_Test
$ php $(pear config-get test_dir)/Horde_SessionHandler/Horde/SessionHandler/AllTests.php
 [2016-08-27 06:29 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2016-08-27 06:29 UTC] yohgaki@php.net
I don't see problem with current PHP-7.0/7.1 branches. 

Are you sure your system is using other save handlers like memcache, etc?
Use following script. You should see undefined var error always if PHP is working correctly.

<?php
error_reporting(-1);
ini_set('session.save_handler', 'files');
ini_set('session.save_path','/tmp');
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 1);
ini_set('session.gc_maxlifetime', -1);
session_name('sessionname');
var_dump(session_start());
$_SESSION['cnt']++;
 [2016-08-27 06:30 UTC] yohgaki@php.net
Are you sure your system is NOT using other save handlers like memcache, etc?
 [2016-08-30 10:19 UTC] yunosh@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: yunosh
 [2016-08-30 10:19 UTC] yunosh@php.net
Looks like this has been fixed in the meantime.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Jan 30 15:03:49 2023 UTC