php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17566 phpinfo() causes load of 2+
Submitted: 2002-06-02 10:20 UTC Modified: 2002-12-27 01:00 UTC
Votes:2
Avg. Score:3.5 ± 1.5
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: msopacua at idg dot nl Assigned:
Status: No Feedback Package: Apache2 related
PHP Version: 4.3-dev OS: BSD/OS 4.2
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: msopacua at idg dot nl
New email:
PHP Version: OS:

 

 [2002-06-02 10:20 UTC] msopacua at idg dot nl
Requesting phpinfo() takes the machine load to 2+ and it never gets back, until apache is stopped. I have ktrace output, for anybody that wants it and seems to contain a lot of '(semop|select) -1 errno 4 Interrupted system call' lines.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-02 19:02 UTC] sniper@php.net
Please try the latest CVS snapshot from http://snaps.php.net/ as I think this is fixed already.

 [2002-06-03 03:38 UTC] msopacua at idg dot nl
Nope - still there.
php4-200206021800

Additionally - it may or may not be related - there's no info whatsover reported on the Apache2 SAPI, in phpinfo(). Just the header 'Apache 2'.
 [2002-06-03 07:36 UTC] sniper@php.net
What were the configure lines for both Apache2 and PHP ??
Someone said that Apache2 doesn't quite work with BSD? 
(depends which MPM is used)

 [2002-06-03 08:08 UTC] msopacua at idg dot nl
About the Apache-2 comment:
I haven't been able to use it for anything else than an image server, since neither mod_perl nor php work well.

Indeed - threads and dynamic linking are a different flavour on BSD/OS. SIGHUP and SIGUSR are broken in apache2 without php as well, but they do a SIGTERM/SIGKILL and are then able to restart. With php compiled in this breaks with a segfault.

Configure options:

$ cat ../httpd-2.0.36/configure-cmd.sh ./configure-cmd.sh
#!/bin/bash

CFLAGS=-g \
./configure \
        --prefix=/aphack2 \
        --disable-threads \
        --with-port=8080 \
        --with-mpm=prefork \
        --disable-file-cache \
        --enable-charset-lite \
        --disable-cache \
        --disable-disk-cache \
        --disable-mem-cache \
        --enable-ext-filter \
        --enable-deflate \
        --with-z=/weblib/local \
        --disable-include \
        --enable-expires \
        --enable-headers \
        --enable-usertrack \
        --enable-unique-id \
        --disable-proxy \
        --disable-proxy-connect \
        --disable-proxy-ftp \
        --disable-proxy-http \
        --disable-ssl \
        --enable-http \
        --enable-info \
        --enable-cgi \
        --enable-speling \
        --disable-rewrite \
        --enable-so \
        --enable-dav=no \
        --enable-shared=max
#!/bin/bash

SHELL=/bin/bash \
./configure \
        --prefix=/phphack2 \
        --with-config-file-path=/phphack2/lib \
        --enable-debug \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-cli \
        --enable-session \
        --disable-short-tags \
        --with-apxs2=/aphack2/bin/apxs \
        --with-mysql=/weblib/local \
        --with-pear \
        --without-xml \
        --with-pic \
        --without-tsrm
 [2002-09-29 22:55 UTC] iliaa@php.net
Please try using this CVS snapshot:

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


 [2002-10-06 22:57 UTC] msopacua@php.net
No change at all.
Apache 2.0.43.

load averages:  6.81,  3.75,  1.91
149 processes: 2 running, 147 sleeping
CPU states:  0.2% user,  0.0% nice,  0.2% system,  0.0% interrupt, 99.6% idle
Memory: Real: 318M/397M Virt: 440M/1252M Free: 477M

 [2002-10-06 23:01 UTC] msopacua@php.net
hmm......that is a hint:
/home/mdev/cvs/php4/ext/standard/html.c(667) :  Freeing 0x0820BA24 (396 bytes), script=-
Last leak repeated 383 times

383 times?
 [2002-10-06 23:09 UTC] msopacua@php.net
PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_char
set TSRMLS_DC)
{
    int i, j, maxlen, len;
    char *replaced;
    enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC);
    int matches_map;

    maxlen = 2 * oldlen;
    if (maxlen < 128)
        maxlen = 128;    replaced = emalloc (maxlen); // #line 667
    len = 0;

    i = 0;
    while (i < oldlen) {
....

        }           
    }
    replaced[len] = '\0';
...


So what happens if oldlen = 0 and more importantly: how can oldlen become 0?
 [2002-10-07 06:41 UTC] wez@php.net
The problem is in the recent changes to ext/standard/info.c which is calling php_escape_html_entities (via php_info_html_esc) and PUTS()-ing the result.
It never efree's it.
I suspect the loading problems will go away if you build a --disable-debug version of PHP.
 [2002-10-09 13:26 UTC] msopacua@php.net
--disable-debug affects the display of the memory leak :-)

It does not affect the error itself. Still an increasing load.
I've added some trace warnings, and it seems that every string is passed through php_escape_html_entities twice! Here's an anonimized snippet:
PHP Warning:  oldlen is 15. old is <SERVER_SOFTWARE>, newlen=1210382182, all=1, quote_style=2, hint_charset is <(null)>
 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Putting a terminator at position 15 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Returning replaced <SERVER_SOFTWARE> (len=15) in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  oldlen is 15. old is <SERVER_SOFTWARE>, newlen=1211165388, all=1, quote_style=2, hint_charset is <(null)>
 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Putting a terminator at position 15 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Returning replaced <SERVER_SOFTWARE> (len=15) in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  oldlen is 34. old is <Apache/2.0.43 (Unix) PHP/4.4.0-dev>, newlen=1210382258, all=1, quote_style=2, hint_chars
et is <(null)>
 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Putting a terminator at position 34 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Returning replaced <Apache/2.0.43 (Unix) PHP/4.4.0-dev> (len=34) in /webdocs/host.domain.nl/public_html/php
2345.php on line 2
PHP Warning:  oldlen is 34. old is <Apache/2.0.43 (Unix) PHP/4.4.0-dev>, newlen=1211165388, all=1, quote_style=2, hint_chars
et is <(null)>
 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Putting a terminator at position 34 in /webdocs/host.domain.nl/public_html/script.php on line 2
PHP Warning:  Returning replaced <Apache/2.0.43 (Unix) PHP/4.4.0-dev> (len=34) in /webdocs/host.domain.nl/public_html/php
2345.php on line 2
 [2002-10-11 22:21 UTC] iliaa@php.net
Please try using this CVS snapshot:

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

The memory leak problem has been corrected, can you please check if the phpinfo() still drives up the load.
 [2002-10-27 19:02 UTC] sniper@php.net
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.


 [2002-10-27 21:11 UTC] msopacua@php.net
it's "somewhat" better.
Load stops at 3 flat. Memory doesn't go up.
 [2002-12-08 17:26 UTC] iliaa@php.net
Please try using this CVS snapshot:

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


 [2002-12-27 01:00 UTC] php-bugs at lists dot php dot net
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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 00:01:31 2024 UTC