php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #872 Large numbers of Apache log directives cause PHP to fail
Submitted: 1998-10-25 17:00 UTC Modified: 1998-10-25 17:09 UTC
From: maupin at easystreet dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 3.0.5 OS: SunOS 4.1.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: maupin at easystreet dot com
New email:
PHP Version: OS:

 

 [1998-10-25 17:00 UTC] maupin at easystreet dot com
Hi, 
 
        When Apache is compiled with PHP and is configured with a 
large number of virtual hosts, each of which has its own set of log 
file directives, PHP returns empty documents (i.e., Communicator 
reports "Document contains no data").  In my experiments, I've found 
that the problem manifests itself when somewhere between 110 and 115 
log file directives are present.  My configuration uses "TransferLog", 
"ErrorLog", and "RewriteLog", but I suspect other log directives would 
contribute to the problem as well.  I'm running PHP v3.0.5 as a module 
in Apache v1.3.2 under SunOS v4.1.4.  No modules were compiled into 
PHP.  I've observed the same problem in PHP versions going back to at 
least v3.0.  Red Hat Linux v5.1 with kernel v2.0.33 appears immune to 
the problem. 
 
        The call to the "YY_INPUT" macro on line 4329 in the 
"yy_get_next_buffer" function of "language-scanner.c" generates the 
error.  I've run Apache with the "-X" option under gdb and while the 
server does not core dump, it exits with status code 2 after executing 
"YY_INPUT" and "input in flex scanner failed" is written to the 
server's error log.  PHP was compiled with GNU flex v2.5.4 and gcc 
v2.7.2.2.  Here is a backtrace captured just prior to the execution of 
"YY_INPUT"... 
 
 
#0  yy_get_next_buffer () at language-scanner.c:4329 
#1  0x50214 in lex_scan (phplval=0xefffe670) at language-scanner.c:4164 
#2  0xc740 in read_next_token (tcm=0xcf098, token=0xefffe58c,  
    phplval=0xefffe670) at token_cache.c:139 
#3  0x40c8 in phplex (phplval=0xefffe670) at main.c:435 
#4  0x3d770 in phpparse () at /usr/local/share/bison.simple:387 
#5  0x62e0 in php3_parse (yyin=0xef6b1fd8) at main.c:1465 
#6  0x66a8 in apache_php3_module_main (r=0x146b30, fd=128,  
    display_source_mode=0, preprocessed=0) at main.c:1845 
#7  0x25b4 in send_php3 () 
#8  0x263c in send_parsed_php3 () 
#9  0x59aa8 in ap_invoke_handler () 
#10 0x7a54c in process_request_internal () 
#11 0x7a5cc in ap_process_request () 
#12 0x6dbfc in child_main () 
#13 0x6ddf4 in make_child () 
#14 0x6dff8 in startup_children () 
#15 0x6eb24 in standalone_main () 
#16 0x6f694 in main () 
 
 
        The problem can be reproduced by creating an Apache 
configuration with simple <VirtualHost> sections like the following. 
I recommend starting with 120 and removing "TransferLog" directives 
until the error disappears.  The ServerName directives aren't 
necessary, but they aid in counting. 
 
 
Listen          192.168.1.1:80 
NameVirtualHost 192.168.1.1:80 
 
<VirtualHost    192.168.1.1:80> 
ServerName      host001 
TransferLog     /dev/null 
</VirtualHost> 
 
<VirtualHost    192.168.1.1:80> 
ServerName      host002 
TransferLog     /dev/null 
</VirtualHost> 
</VirtualHost> 
 
. 
. 
. 
 
<VirtualHost    192.168.1.1:80> 
ServerName      host119 
TransferLog     /dev/null 
</VirtualHost> 
 
<VirtualHost    192.168.1.1:80> 
ServerName      host120 
TransferLog     /dev/null 
</VirtualHost> 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-10-25 17:09 UTC] zeev
You're hitting the file descriptor limit of your environment.
If you truss Apache, you'd probably see that it fails
trying to open files.
The limit on your Solaris box is probably lower than the limit
on the RedHat box, which is why you only experience it
under Solaris.
You can check the file descriptor limit in the shell
limits ('limit' under tcsh, or 'ulimit -a' under sh)

Note that setting the TransferLog to /dev/null does NOT
save you a file descriptor - you'd have just as many open
file descriptors pointing at /dev/null (which would bring
you to over 200 open files, which is dangerously close to
256, which is often the fd limit)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 10:01:29 2024 UTC