php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52720 User Session handler Crash [FPM and APC]
Submitted: 2010-08-28 09:47 UTC Modified: 2013-02-18 00:34 UTC
Votes:4
Avg. Score:4.0 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: mat999 at gmail dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 5.3.3 OS: Debian Lenny Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
44 - 4 = ?
Subscribe to this entry?

 
 [2010-08-28 09:47 UTC] mat999 at gmail dot com
Description:
------------
Registering a user session handler crashes the system.

System:
php 5.3.3-fpm (from dotdeb repo)
APC extension



Test script:
---------------
class Session
    {      
        public static function Init(){
            ini_set('session.save_handler', 'user');

            session_set_save_handler(array('Session', 'open'),
            array('Session', 'close'),
            array('Session', 'read'),
            array('Session', 'write'),
            array('Session', 'destroy'),
            array('Session', 'gc')
            );
            session_start();
        }
        public static function open() {
            return true;
        }
        public static function close() {
            return true;
        }
        public static function read($id) {
            return '';
            //return apc_exists('ns_'.$id)?(string)apc_fetch('ns_'.$id):'';
        }
        public static function write($id, $data) {
            //return apc_store('ns_'.$id,$data,1200);
        }
        public static function destroy($id) {
            //apc_delete('ns_'.$id);
            return true;
        }
        public static function gc($max) {
            return true;
        }
    }

Expected result:
----------------
Session registration

Actual result:
--------------
Crash, if someone gives me details on how to valgrind php-fpm ill post a backtrace, ive failed to do so.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-28 12:19 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-08-28 12:19 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

A backtrace would help already, see the instructions on bugs.php.net.
 [2010-08-28 16:30 UTC] mat999 at gmail dot com
-Status: Feedback +Status: Open
 [2010-08-28 16:30 UTC] mat999 at gmail dot com
its not that easy for php-fpm, and this is php-fpm specific.
 [2010-08-28 16:40 UTC] rasmus@php.net
Just attach gdb to a runnning php-fpm process.

gdb /usr/bin/php-fpm 1234

where 1234 is the process id.  Then hit 'c' for continue in gdb and hit port 80 
until you hit the process you attached to.
 [2010-08-28 16:42 UTC] mat999 at gmail dot com
ive tried that but it doesnt propagate to child processes and php-fpm is multy threaded.
 [2010-08-28 16:43 UTC] rasmus@php.net
No it isn't.
 [2010-08-28 16:45 UTC] mat999 at gmail dot com
ummm? Yes it is.


        |-php5-fpm(53652)-+-php5-fpm(21570,www-data)
        |                 |-php5-fpm(22058,www-data)
        |                 |-php5-fpm(22305,vu2001)
        |                 |-php5-fpm(22307,vu2001)
        |                 |-php5-fpm(22308,vu2001)
        |                 |-php5-fpm(22311,vu2001)
        |                 |-php5-fpm(22313,vu2001)
        |                 |-php5-fpm(22315,vu2001)
        |                 |-php5-fpm(22317,vu2001)
        |                 |-php5-fpm(22318,vu2001)
        |                 |-php5-fpm(22319,vu2001)
        |                 |-php5-fpm(22326,vu2001)
        |                 |-php5-fpm(22327,vu2001)
        |                 |-php5-fpm(22328,vu2001)
        |                 |-php5-fpm(22330,vu2001)
        |                 |-php5-fpm(22354,vu2009)
        |                 |-php5-fpm(22356,vu2009)
        |                 |-php5-fpm(22362,vu2009)
        |                 `-php5-fpm(22381,vu2009)
 [2010-08-28 16:48 UTC] rasmus@php.net
Those are processes, not threads.  There is a root-owned master process that 
preforks multiple child processes to handle requests.  Simple set that to a low 
number in your config file and attach gdb to one of the children.  It's easy.
 [2010-08-28 16:53 UTC] mat999 at gmail dot com
Ok then, dont get precise.

Ill have to setup a dev install then on my local PC since I cant do this on my production server. Ill be away tomorow/today (its 1am) so Ill have to do it on monday unless someone test the above code on php-fpm before then.
 [2010-08-29 14:34 UTC] johannes@php.net
-Status: Open +Status: Feedback
 [2010-08-29 14:34 UTC] johannes@php.net
I'd also suggest using our sources. We have no control over patches by dotdeb developers and don't know them
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 03:01:29 2024 UTC