#20551 [Opn-Fbk]: Output compression causes segfaults (ob_gzhandler)

2003-02-25 Thread sniper
 ID:   20551
 Updated by:   [EMAIL PROTECTED]
 Reported By:  sroussey at network54 dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Apache related
 Operating System: RedHat 7.2
 PHP Version:  4.3.0
 New Comment:

Please try using this CVS snapshot:

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

There was a fix for a possible crash in sapi_apache_header_handler() so
please try the latest  snapshot.



Previous Comments:


[2003-02-24 12:29:22] plant at virtualsolution dot net

I have see the same problem on PHP4.3.1 Apache 1.3.27 Redhat 7.3:
Before the upgrade to PHP 4.3.1 with my 4.2.3,
ob_start (ob_gzhandler) work OK.
Now there aren't way to compress the output, i try also
ini_set(output_handler, ob_gzhandler);
or
ini_set ( zlib.output_compression, 1);

with no result.

if i try to return to my old ob_start (ob_gzhandler) ..
now php return me this Worning:
Warning: (null)() [ref.outcontrol]: output handler 'ob_gzhandler'
cannot be used twice in Unknown on line 0

Any idea ??



[2003-02-14 00:57:47] sroussey at network54 dot com

Tried php4-STABLE-200302140230 and still it segfaults in the Apache
module. Either I patch PHP to check r for null, or I turn off
'ob_gzhandler' to stop the segfaults.



[2003-02-13 19:55:22] [EMAIL PROTECTED]

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.





[2003-02-03 04:19:58] [EMAIL PROTECTED]

keep at feedback status until the actual feedback request
is completed (testing of the latest stable snapshot)




[2003-01-31 11:01:15] sroussey at network54 dot com

I now have verified that the bug remains into the release version of
4.3.0. I'll check the php4-STABLE-latest.tar.gz version this weekend.

(Note that with this patch upgrading to v4.3 I no longer see segfaults
in the Apache log!! Sweet!)



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20551

-- 
Edit this bug report at http://bugs.php.net/?id=20551edit=1



#20551 [Opn-Fbk]: Output compression causes segfaults (ob_gzhandler)

2003-02-03 Thread sniper
 ID:   20551
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Feedback
 Bug Type: Apache related
 Operating System: RedHat 7.2
 PHP Version:  4.3.0
 New Comment:

keep at feedback status until the actual feedback request
is completed (testing of the latest stable snapshot)



Previous Comments:


[2003-01-31 11:01:15] [EMAIL PROTECTED]

I now have verified that the bug remains into the release version of
4.3.0. I'll check the php4-STABLE-latest.tar.gz version this weekend.

(Note that with this patch upgrading to v4.3 I no longer see segfaults
in the Apache log!! Sweet!)



[2003-01-31 01:00:03] [EMAIL PROTECTED]

No feedback was provided for this bug for over 2 weeks, 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.



[2003-01-15 20:46:50] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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





[2002-12-12 15:06:41] [EMAIL PROTECTED]

Reclassifying since it is the Apache module code where the actual
segfaults occur. 

Short version: SG(server_context) is not checked for null before
dereferencing it in sapi_apache_header_handler() while it is checked in
other functions.



[2002-12-06 09:30:55] [EMAIL PROTECTED]

Finally.

In file:
sapi/apache/mod_php4.c

The crash is in sapi_apache_header_handler(). This line is apparently
not guaranteed:

request_rec *r = (request_rec *) SG(server_context);

As r is dereferenced and not valid some small percent of the time. It
may be indicative of some other error. Further investigation as to why
needs to be done.

I added a few other checks while tracking this bug down. Here is the
function as I have it now. No more segfaults in the error_log. The line
to note is the check for !r. Also, I don't think it hurts to check for
null in other places (!sapi_header || !sapi_header-header).



/* {{{ sapi_apache_header_handler
 */
int sapi_apache_header_handler(sapi_header_struct *sapi_header,
sapi_headers_struct *sapi_headers TSRMLS_DC)
{
char *header_name, *header_content, *p;
request_rec *r = (request_rec *) SG(server_context);

if (!sapi_header) {
return 0;
}

if (!sapi_header-header) {
return 0;
}

header_name = sapi_header-header;

header_content = strchr(header_name, ':');
if (!header_content || !r) {
efree(sapi_header-header);
return 0;
}

header_name =
estrndup(header_name,header_content-header_name);
if (!header_name){
return 0;
}

do {
header_content++;
} while (*header_content==' ');


if (!strcasecmp(header_name, Content-Type)) {
r-content_type = pstrdup(r-pool, header_content);
} else if (!strcasecmp(header_name, Set-Cookie)) {
table_add(r-headers_out, header_name,
header_content);
} else if (sapi_header-replace) {
table_set(r-headers_out, header_name,
header_content);
} else {
table_add(r-headers_out, header_name,
header_content);
efree(header_name);
efree(sapi_header-header);

return 0;  /* don't use the default SAPI mechanism, Apache
duplicates this functionality */
}
/* }}} */



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20551

-- 
Edit this bug report at http://bugs.php.net/?id=20551edit=1




#20551 [Opn-Fbk]: Output compression causes segfaults (ob_gzhandler)

2003-01-15 Thread iliaa
 ID:   20551
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Feedback
 Bug Type: Apache related
 Operating System: RedHat 7.2
 PHP Version:  4.3.0RC3
 New Comment:

Please try using this CVS snapshot:

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




Previous Comments:


[2002-12-12 15:06:41] [EMAIL PROTECTED]

Reclassifying since it is the Apache module code where the actual
segfaults occur. 

Short version: SG(server_context) is not checked for null before
dereferencing it in sapi_apache_header_handler() while it is checked in
other functions.



[2002-12-06 09:30:55] [EMAIL PROTECTED]

Finally.

In file:
sapi/apache/mod_php4.c

The crash is in sapi_apache_header_handler(). This line is apparently
not guaranteed:

request_rec *r = (request_rec *) SG(server_context);

As r is dereferenced and not valid some small percent of the time. It
may be indicative of some other error. Further investigation as to why
needs to be done.

I added a few other checks while tracking this bug down. Here is the
function as I have it now. No more segfaults in the error_log. The line
to note is the check for !r. Also, I don't think it hurts to check for
null in other places (!sapi_header || !sapi_header-header).



/* {{{ sapi_apache_header_handler
 */
int sapi_apache_header_handler(sapi_header_struct *sapi_header,
sapi_headers_struct *sapi_headers TSRMLS_DC)
{
char *header_name, *header_content, *p;
request_rec *r = (request_rec *) SG(server_context);

if (!sapi_header) {
return 0;
}

if (!sapi_header-header) {
return 0;
}

header_name = sapi_header-header;

header_content = strchr(header_name, ':');
if (!header_content || !r) {
efree(sapi_header-header);
return 0;
}

header_name =
estrndup(header_name,header_content-header_name);
if (!header_name){
return 0;
}

do {
header_content++;
} while (*header_content==' ');


if (!strcasecmp(header_name, Content-Type)) {
r-content_type = pstrdup(r-pool, header_content);
} else if (!strcasecmp(header_name, Set-Cookie)) {
table_add(r-headers_out, header_name,
header_content);
} else if (sapi_header-replace) {
table_set(r-headers_out, header_name,
header_content);
} else {
table_add(r-headers_out, header_name,
header_content);
efree(header_name);
efree(sapi_header-header);

return 0;  /* don't use the default SAPI mechanism, Apache
duplicates this functionality */
}
/* }}} */



[2002-12-05 18:34:16] [EMAIL PROTECTED]

OK, I was able to have gbb attach to one of the 500 children and wait
for a segault. This is version 4.2.3, as this is from our production
site (late at night I'll try and do the same for a full debug version
of 4.3RC2):

Program received signal SIGSEGV, Segmentation fault.
0x080a9b2c in sapi_apache_header_handler ()
(gdb) bt
#0  0x080a9b2c in sapi_apache_header_handler ()
#1  0x080af403 in sapi_add_header_ex ()
#2  0x080b5700 in zif_ob_gzhandler ()
#3  0x08124392 in call_user_function_ex ()
#4  0x080b20f9 in php_end_ob_buffer ()
#5  0x080b23bb in php_end_ob_buffers ()
#6  0x080ac0a7 in php_request_shutdown ()
#7  0x081530d8 in run_cleanups ()
#8  0x08151ec8 in ap_clear_pool ()
#9  0x08151f28 in ap_destroy_pool ()
#10 0x08151e9b in ap_clear_pool ()
#11 0x0815e92b in child_main ()
#12 0x0815ef0b in make_child ()
#13 0x0815f1e9 in perform_idle_server_maintenance ()
#14 0x0815f69a in standalone_main ()
#15 0x0815fc2c in main ()



[2002-12-04 17:59:13] [EMAIL PROTECTED]

status - open, updated version.

(please, don't use 'Add Comment' when you edit your own submission..use
'Edit Submission')





[2002-12-04 11:36:49] [EMAIL PROTECTED]

Yes, the problem occurs without the Zend addon. Zend Accelerator won't
work with PHP 4.3 anyhow, so I turned it off. In the other message I
proved myself to be a bad typist. :( I meant to say _without_ Zend
Accelerator...



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20551

-- 
Edit this bug report at 

#20551 [Opn-Fbk]: Output compression causes segfaults (ob_gzhandler)

2002-11-21 Thread derick
 ID:   20551
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Feedback
 Bug Type: Output Control
 Operating System: RedHat 7.2
 PHP Version:  4.2.3
 New Comment:

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

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.


Previous Comments:


[2002-11-21 14:49:28] [EMAIL PROTECTED]

I should say that by disabling, I meant that I commented out the line

  ob_start ('ob_gzhandler');

in our auto-prepend file.



[2002-11-21 14:47:55] [EMAIL PROTECTED]

Apache 1.3.27 error_log has a long list of segfaults (usually 3-12 a
minute, but not every minute). Disabling output compression (via 
ob_start ('ob_gzhandler');) stops all the segfaults.




-- 
Edit this bug report at http://bugs.php.net/?id=20551edit=1