Re: PHP & Sessions generates Segment Faults

From: Date: Wed, 22 Jan 2003 18:53:34 +0000
Subject: Re: PHP & Sessions generates Segment Faults
Groups: php.general 
Request: Send a blank email to php-general+get-132661@lists.php.net to get a copy of this message
Hey, I'm back =) I was unable to get it to run, I've setup the most basic session handler i could think of, a simple counter, if any of you could test it, I'd be very thankful, the URL is http://fatboy.blaster.nu/~blaster/sess_test/ Now, it does not "cut" the content, not sure why it doesn't do that, but I'm pretty sure it generates segment faults, cause at several occations when you click Destroy Session and then return, it will display "Cannot find server" in MSIE, and I've checked with my sniffer, Apache simply closes the TCP connection as soon as my request is sent which probably means the child handling my request segment faulted. Still, if ANYONE has ANYTHING on Segment faults with PHP session, I'd like to hear about it, I'm willing to try pretty much anything! I've already tried several different DB libs and Session handler libs, I'm aware of the "MM" lib which many have had problems with before, I don't use that. One thing that really bugs me though, is that if I don't touch the "session.save_handler" option and leave it to "files", EVERYTHING works just great! This kinda makes me think all the DB libs I have tried is invalid, but that cannot possible be the case, I've even tried PEAR sessionlib, which is coded by a team supported by the PHP group (?). Is it possible that the way PHP handles the "files" session and "user" sessions is different? Like, they patched one of the methods but forgot to fix the "user" mode? :) Also, while searching google, I came across a very interesting URL, http://www.phpbuilder.com/mail/php-developer-list/200001/0600.php However, the BUG description ID to http://bugs.php.net/ seems to be invalid, it only takes me to the frontpage, and searching for it gives me nothing, is this bug fixed? If so, in what version? Thanks for your time, again, anything related to PHP session and possible segment faults is MUCH appreciated! At 21:15 2003-01-21 +1100, you wrote:
I don't really have an answer... try to get the REALLY basic session example from the manual to work... this will ruke out your save handler and all sorts of other stuff, if you're still getting the errors with basic code and default handlers. Justin on 21/01/03 9:01 PM, Blaster (blaster@blaster.nu) wrote: Okay, I'm not using "mm" as my session handler, in PHP.ini, I still have "files", but in my script, I temporariliy modify this with if (!ini_set("session.save_handler", "user")) echo("Unable to switch to Session User mode."); if (!session_set_save_handler("db_session_open", "db_session_close", "db_session_read", "db_session_write", "db_session_destroy", "db_session_garbage")) echo("Unable to init custom session handlers!"); These are my own handlers, working with MySQL. I have however also tried setting it to user and only doing the "session_set_save_handler()" part, but gives me random segment faults either way. The strange part is that it doesn't always crash, i can view the same page 10 times, and it only segment faults on one of the views,.. how is this possible? Please advice =) At 12:51 2003-01-21 +1100, you wrote:
Hi, I had this problem a few weeks back. The host changed the sessions from 'mm' to 'files' in php.ini and restarted, and all was ok... not sure of the reasons behind the faults, but I had this EXACT problem (with standard session stuff). Justin on 21/01/03 2:29 AM, Blaster (blaster@blaster.nu) wrote:
Hi OS: Debian Linux (Woody), kernel 2.2.20 PHP: v4.1.2 I'm having some troubles with my sessions, when the page is sent to the visitor, it sometimes stops after ½ the page or so. 90% of the times, it works perfectly to visit the page, so this appears to be totally random. However, I have reason to believe it has something to do with my sessions, I have
written a
custom session lib which works with MySQL, and then set it up with
session_set_save_handler()
Now, I checked the error logs of my Apache HTTP, and it's filled with [Mon Jan 20 15:20:54 2003] [notice] child pid 19500 exit signal Segmentation fault (11) [Mon Jan 20 15:20:54 2003] [notice] child pid 19399 exit signal Segmentation fault (11) FATAL: emalloc(): Unable to allocate -916562933 bytes [Mon Jan 20 15:21:02 2003] [notice] child pid 19499 exit signal Segmentation fault (11) [Mon Jan 20 15:21:20 2003] [notice] child pid 19401 exit signal Segmentation fault (11) [Mon Jan 20 15:21:32 2003] [notice] child pid 19514 exit signal Segmentation fault (11) [Mon Jan 20 15:21:35 2003] [notice] child pid 19403 exit signal Segmentation fault (11) The reason to why I'm sure it's PHP is the "emalloc()" line, which
I'm told
only can be generated by PHP. Now, I'm wondering if this is a know
bug, or
am I doing something wrong? In short: The content stream (HTML stream) is interrupted, probably because of a segment fault caused by PHP Session functions. Is there a way to work around this bug without performing a complete upgrade? If this has already been fixed
in a
newer version, which version do I need to get? 4.3.0 is not really an option to me, since I'm running APT-GET, their latest version is 4.1.2 (stable) and 4.2.6 (unstable) (or something) Code I use to setup the sessions: session_start(); session_register("SESSION"); if (!isset($SESSION)) { $SESSION = array(); $SESSION["submitdata"] = array(); $SESSION["addr"] = $REMOTE_ADDR; $SESSION["user"] = user_auth($_COOKIE['replayuser'], $_COOKIE['replaypass']); } # Prevent Session hi-jacking, only allow people from the IP who
created the
session, or else # re-auth user if ($SESSION["addr"] != $REMOTE_ADDR) { $SESSION["user"] = user_auth($_COOKIE['replayuser'],
$_COOKIE['replaypass']);
$SESSION["addr"] = $REMOTE_ADDR; } A quick reply is appreciated! Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses]
--- [This E-mail scanned for viruses]


« previous php.general (#132661) next »