php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14274 httpd process severely leaks memory for large LDAP queries
Submitted: 2001-11-28 19:08 UTC Modified: 2001-11-30 02:30 UTC
From: Darren dot Gamble at sjrb dot ca Assigned:
Status: Closed Package: LDAP related
PHP Version: 4.0.6 OS: Linux 7.2
Private report: No CVE-ID: None
 [2001-11-28 19:08 UTC] Darren dot Gamble at sjrb dot ca
I've installed apache-1.3.20-16 , php-4.0.6-7 and php-ldap-4.0.6-7 , all via the Redhat 7.2 RPMs.

I've also written a simple script to do performance testing against an LDAP server running on the same machine.  The script itself runs fine, but the memory usage of httpd quickly balloons with each iteration, decreasing the performance.  After running the script for only about 10 times or so, httpd has used a great deal of memory and swap on the machine and stops responding.  The init script needs to run twice to stop the server, which frees the memory.

The only thing that shows up in the httpd error.log is a few lines of:

[warn] child process x still did not exit, sending a SIGTERM

The machine has 512MB each of RAM and swap.  The LDAP database ldif is about 7M in size, with about 8k entries.

Please reply if there is any extra information that could be provided.  We had looked forward to developing our DNS application on PHP, and would still like to make this happen if possible.

Here's the revelant portion of the script:

$queries = array("masterserver=ns2so.cg.shawcable.net",
                 "(|(masterserver=ns2so.cg.shawcable.net)(secondaryserver=ns2so.cg.shawcable.net))",
                 "objectclass=*");
foreach ( $queries as $key => $query ) {
  echo "<LI>Starting query \"".$query."\"...<BR>";
  flush();
  $start_time = posix_times();

  $search_session = ldap_search($ldap_link_id, $LDAP_ROOT_DN[$LDAP_SERVER_ID] , "$query" );

  if ( $search_session ) {
    $search_results = ldap_get_entries($ldap_link_id,$search_session);
  } else {
    page_severe_error("Test failed: ".my_ldap_error());
  }

  $end_time = posix_times();
  $elapsed_time = ($end_time['ticks'] - $start_time['ticks']) / 100.0;
  echo "Done.  Elapsed time: <B>".$elapsed_time."s</B>. <B>".$search_results['count']."</B> results returned.<BR><BR></LI>\n";

}



Here's the configure command, as reported by PHP:

'./configure' 'i386-redhat-linux' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-bz2' '--with-curl' '--with-db3' '--with-dom' '--with-exec-dir=/usr/bin' '--with-gd' '--with-gdbm' '--with-gettext' '--with-jpeg-dir=/usr' '--with-mm' '--with-openssl' '--with-png' '--with-regex=system' '--with-ttf' '--with-zlib' '--with-layout=GNU' '--enable-debugger' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-wddx' '--without-mysql' '--without-unixODBC' '--without-oracle' '--without-oci8' '--with-pspell' '--with-xml'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-30 02:30 UTC] venaas@php.net
CVS and 4.1.0 should be okay. Please test and reopen if
I'm wrong
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC