|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-11-21 14:47 UTC] sroussey at network54 dot com
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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 09:00:02 2025 UTC |
I should say that by disabling, I meant that I commented out the line ob_start ('ob_gzhandler'); in our auto-prepend file.The problem with setting it system wide is that it will try to compress images and javascripts. No browser likes compressed images and Netscape dies on compressed javascripts. Or are you suggesting that I use: ini_set ( "zlib.output_compression", 1); instead of: ob_start ('ob_gzhandler'); ?? Does this work in PHP 4.2.3?Using ini_set ( "zlib.output_compression", 1);// or "On" or 4096 ... instead of: ob_start ('ob_gzhandler'); does not actually compress pages...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 */ } /* }}} */