php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50733 Garbage Collection fails
Submitted: 2010-01-12 21:32 UTC Modified: 2010-01-13 15:28 UTC
From: elmex at voll dot in Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.2.12 OS: FreeBSD 6.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: elmex at voll dot in
New email:
PHP Version: OS:

 

 [2010-01-12 21:32 UTC] elmex at voll dot in
Description:
------------
The Garbage Collection ist set to session.gc_maxlifetime=1440, but there are a lot of session files set are older. In all hosts on the server there is a virtual host setting for session.save_path like session.save_path="/usr/local/www/hostname/phptmp". That is the only session related setting, that was modified. A find for the files shows currently:

find /usr/local/www/ -maxdepth 3 -mindepth 3 -name 'sess_*' -cmin +24 | wc -l
    8443

(amin is the same:)

find /usr/local/www/ -maxdepth 3 -mindepth 3 -name 'sess_*' -amin +24 | wc -l
    8443



Reproduce code:
---------------
no code, just settings

Expected result:
----------------
session files should be deleted after session.gc_maxlifetime or earlier

Actual result:
--------------
session files are not deleted or deleted too late

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-12 22:07 UTC] derick@php.net
Can you post the other session related settings a well?
 [2010-01-13 14:54 UTC] elmex at voll dot in
Sure, here they are (from php_info):

Session Support 	enabled
Registered save handlers 	files user
Registered serializer handlers 	php php_binary

Directive	Local Value	Master Value
session.auto_start	Off	Off
session.bug_compat_42	Off	Off
session.bug_compat_warn	On	On
session.cache_expire	180	180
session.cache_limiter	nocache	nocache
session.cookie_domain	no value	no value
session.cookie_httponly	Off	Off
session.cookie_lifetime	0	0
session.cookie_path	/	/
session.cookie_secure	Off	Off
session.entropy_file	no value	no value
session.entropy_length	0	0
session.gc_divisor	1000	1000
session.gc_maxlifetime	1440	1440
session.gc_probability	1	1
session.hash_bits_per_character	5	5
session.hash_function	0	0
session.name	PHPSESSID	PHPSESSID
session.referer_check	no value	no value
session.save_handler	files	files
session.save_path	/usr/local/www/XXXX/phptmp	no value
session.serialize_handler	php	php
session.use_cookies	On	On
session.use_only_cookies	Off	Off
session.use_trans_sid	0	0
 [2010-01-13 15:28 UTC] jani@php.net
You just misunderstood how the GC works. Your settings mean that GC happening has in 1/1000 chance per request. And that happens only for session files older than 1440 seconds. No bug.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 19:01:35 2025 UTC