php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31984 sessions fail randomly, causes a segmentation fault in apache
Submitted: 2005-02-15 13:44 UTC Modified: 2005-07-18 01:00 UTC
Votes:17
Avg. Score:4.5 ± 0.8
Reproduced:15 of 16 (93.8%)
Same Version:7 (46.7%)
Same OS:5 (33.3%)
From: root at mediamonks dot net Assigned: sniper (profile)
Status: No Feedback Package: Session related
PHP Version: 5CVS-2005-04-11 OS: FreeBSD 4.11-STABLE
Private report: No CVE-ID: None
 [2005-02-15 13:44 UTC] root at mediamonks dot net
Description:
------------
Apache 2.0.53 & mod_php5 5.0.3

Sessions occasionally work, but in two-thirds of the session requests an error is generated and the apache child segfaults.

Error recorded in the logfile:

PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0

Error reported on site:

Notice: Undefined variable: HTTP_SESSION_VARS in <file>
Notice: Undefined variable: _SESSION in in <file>
Warning: session_register() [function.session-register]: Cannot find save handler  in <file>
Warning: session_register() [function.session-register]: Cannot find save handler  in <file>

I'm using php.ini-recommended as php.ini.

Tried commenting out session.save_handler, setting it to "files" and just files.

Reproduce code:
---------------
session_start();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-15 14:30 UTC] root at mediamonks dot net
with notices on the log file records:

PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0
PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0
PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0
[Tue Feb 15 14:27:45 2005] [notice] child pid 83780 exit signal Segmentation fault (11)
[Tue Feb 15 14:27:45 2005] [notice] child pid 83776 exit signal Segmentation fault (11)
[Tue Feb 15 14:27:45 2005] [notice] child pid 83710 exit signal Segmentation fault (11)
PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0
PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0
[Tue Feb 15 14:27:48 2005] [notice] child pid 83752 exit signal Segmentation fault (11)
[Tue Feb 15 14:27:48 2005] [notice] child pid 83713 exit signal Segmentation fault (11)
 [2005-02-16 16:02 UTC] root at mediamonks dot net
That CVS build has screwed even more on my system...

Log file records:

httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
Allowed memory size of 16777216 bytes exhausted (tried to allocate 1 bytes)
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
httpd in free(): warning: page is already free
[Wed Feb 16 16:00:54 2005] [notice] child pid 21258 exit signal Segmentation fault (11)

This repeats thousands of times, apache children segfault after each 10 or so, original save handler error remains.
 [2005-02-18 13:09 UTC] root at mediamonks dot net
I thought I'd give the mm handler a try as a workaround, but the same problem is present there:

PHP Fatal error:  Unknown: Cannot find save handler \x02 in Unknown on line 0
[Fri Feb 18 13:08:04 2005] [notice] child pid 73434 exit signal Segmentation fault (11)
 [2005-02-26 22:47 UTC] root at mediamonks dot net
Backtrace:

#0  ps_mm_destroy (data=0x82df880) at /home/terrence/php/php5-STABLE-200502211130/ext/session/mod_mm.c:243
#1  0x284d0a1d in zm_shutdown_ps_mm (type=1, module_number=3)
    at /home/terrence/php/php5-STABLE-200502211130/ext/session/mod_mm.c:295
#2  0x284cf895 in zm_shutdown_session (type=1, module_number=3)
    at /home/terrence/php/php5-STABLE-200502211130/ext/session/session.c:1824
#3  0x2856acfa in module_destructor (module=0x82f0c80) at /home/terrence/php/php5-STABLE-200502211130/Zend/zend_API.c:1500
#4  0x2856d0bd in zend_hash_apply_deleter (ht=0x285e8360, p=0x82efd00)
    at /home/terrence/php/php5-STABLE-200502211130/Zend/zend_hash.c:574
#5  0x2856d1ee in zend_hash_graceful_reverse_destroy (ht=0x285e8360)
    at /home/terrence/php/php5-STABLE-200502211130/Zend/zend_hash.c:640
#6  0x28566f34 in zend_shutdown () at /home/terrence/php/php5-STABLE-200502211130/Zend/zend.c:699
#7  0x28538b54 in php_module_shutdown () at /home/terrence/php/php5-STABLE-200502211130/main/main.c:1516
#8  0x28538b23 in php_module_shutdown_wrapper (sapi_globals=0x285e3140)
    at /home/terrence/php/php5-STABLE-200502211130/main/main.c:1491
#9  0x285a3d85 in php_apache_server_shutdown (tmp=0x0)
    at /home/terrence/php/php5-STABLE-200502211130/sapi/apache2handler/sapi_apache2.c:331
#10 0x2831d8f8 in run_cleanups () from /usr/local/lib/apache2/libapr-0.so.9
#11 0x2831cd11 in apr_pool_clear () from /usr/local/lib/apache2/libapr-0.so.9
#12 0x806890e in main ()
#13 0x805ce2e in _start ()
 [2005-02-28 20:25 UTC] sniper@php.net
What was the configure line you used to configure PHP?

 [2005-02-28 20:35 UTC] root at mediamonks dot net
'./configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-session' '--enable-spl' '--with-regex=php' '--disable-cli' '--with-apxs2=/usr/local/sbin/apxs' '--disable-ipv6' '--prefix=/usr/local' 

and

'./configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--with-mm' '--enable-session' '--enable-spl' '--with-regex=php' '--disable-cli' '--with-apxs2=/usr/local/sbin/apxs' '--disable-ipv6' '--prefix=/usr/local'
 [2005-03-21 11:13 UTC] sniper@php.net
Try without --enable-versioning
 [2005-03-21 12:21 UTC] root at mediamonks dot net
does not change anything
 [2005-04-11 08:24 UTC] root at mediamonks dot net
I thought I'd try attaching gdb to an apache child and provoke a segfault with the latest stable CVS snapshot. 

The result is:

Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x285d9179 in php_apache_sapi_ub_write (
    str=0x80ca924 "<br />\n<b>Fatal error</b>:  Unknown: Cannot find save handler \002 in <b>Unknown</b> on line <b>0</b><br />\n", str_length=105) at /home/terrence/php/php5-STABLE-200504110038/sapi/apache2handler/sapi_apache2.c:76
76              r = ctx->r;
(gdb) bt
#0  0x285d9179 in php_apache_sapi_ub_write (
    str=0x80ca924 "<br />\n<b>Fatal error</b>:  Unknown: Cannot find save handler \002 in <b>Unknown</b> on line <b>0</b><br />\n", str_length=105) at /home/terrence/php/php5-STABLE-200504110038/sapi/apache2handler/sapi_apache2.c:76
#1  0x2857567f in php_ub_body_write_no_header (
    str=0x80ca924 "<br />\n<b>Fatal error</b>:  Unknown: Cannot find save handler \002 in <b>Unknown</b> on line <b>0</b><br />\n", str_length=105) at /home/terrence/php/php5-STABLE-200504110038/main/output.c:684
#2  0x28574592 in php_body_write (
    str=0x80ca924 "<br />\n<b>Fatal error</b>:  Unknown: Cannot find save handler \002 in <b>Unknown</b> on line <b>0</b><br />\n", str_length=105) at /home/terrence/php/php5-STABLE-200504110038/main/output.c:119
#3  0x28564667 in php_printf (format=0x285f5f20 "%s<br />\n<b>%s</b>:  %s in <b>%s</b> on line <b>%d</b><br />\n%s")
    at /home/terrence/php/php5-STABLE-200504110038/main/main.c:399
#4  0x28565192 in php_error_cb (type=1, error_filename=0x28611b8b "Unknown", error_lineno=0, format=0x285f5cb4 "%s", 
    args=0xbfbff1e0 "$\2174\b\021]_(0") at /home/terrence/php/php5-STABLE-200504110038/main/main.c:740
#5  0x285a857b in zend_error (type=1, format=0x285f5cb4 "%s") at /home/terrence/php/php5-STABLE-200504110038/Zend/zend.c:921
#6  0x28564aff in php_verror (docref=0x0, params=0x285f5b58 "", type=1, format=0x285dcf77 "Cannot find save handler %s", 
    args=0xbfbff294 "?~4\b?\221b(?~4\b????\233~[(") at /home/terrence/php/php5-STABLE-200504110038/main/main.c:539
#7  0x28564c3d in php_error_docref0 (docref=0x0, type=1, format=0x285dcf77 "Cannot find save handler %s")
    at /home/terrence/php/php5-STABLE-200504110038/main/main.c:559
#8  0x284d2d3e in OnUpdateSaveHandler (entry=0x82f7a00, new_value=0x8347ee4 "\002", new_value_length=5, mh_arg1=0x0, mh_arg2=0x0, 
    mh_arg3=0x0, stage=16) at /home/terrence/php/php5-STABLE-200504110038/ext/session/session.c:102
#9  0x285b7e9b in zend_alter_ini_entry (name=0x835d0e0 "session.save_handler", name_length=21, new_value=0x835c600 "\002", 
    new_value_length=5, modify_type=2, stage=16) at /home/terrence/php/php5-STABLE-200504110038/Zend/zend_ini.c:227
#10 0x285da754 in apply_config (dummy=0x8107350)
    at /home/terrence/php/php5-STABLE-200504110038/sapi/apache2handler/apache_config.c:169
#11 0x285d9c1c in php_handler (r=0x8355050) at /home/terrence/php/php5-STABLE-200504110038/sapi/apache2handler/sapi_apache2.c:452
#12 0x8063f34 in ap_run_handler ()
#13 0x806448d in ap_invoke_handler ()
#14 0x806173f in ap_process_request ()
#15 0x805d217 in ap_process_http_connection ()
#16 0x806cc10 in ap_run_process_connection ()
#17 0x806ced4 in ap_process_connection ()
#18 0x8062b3b in child_main ()
#19 0x8062c92 in make_child ()
#20 0x8062cee in startup_children ()
#21 0x8063037 in ap_mpm_run ()
#22 0x8068aac in main ()
#23 0x805ce2e in _start ()
 [2005-04-11 08:45 UTC] root at mediamonks dot net
The following "patch" fixes all the errors, and everything works as usual after applying it:

--- session.c   Thu Mar 24 02:32:45 2005
+++ session-new.c       Mon Apr 11 08:39:38 2005
@@ -96,6 +96,8 @@
 {
        SESSION_CHECK_ACTIVE_STATE;
 
+       new_value="files";
        PS(mod) = _php_find_ps_module(new_value TSRMLS_CC);
 
        if (PG(modules_activated) && !PS(mod)) {
 [2005-07-10 19:59 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-07-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-01-18 10:17 UTC] yogesh dot kumar3 at wipro dot com
Hi All,

I am also getting the session error.

The error is as follows:
<<
Warning: session_register() [function.session-register]: open(C:\DOCUME~1\yogumum\Local Settings\Temp\php\session\sess_cd6155c9cbe0eeb55bcc26cfb9c13907, O_RDWR) failed: No such file or directory (2) in D:\jakarta-tomcat-5.0.30\webapps\sns\lib\include\Auth.php on line 289
>>

Please help me in resolving the issue.

Thanks,
Yogesh
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 12 15:01:27 2024 UTC