php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36145 ldap_bind() timeouts
Submitted: 2006-01-24 16:18 UTC Modified: 2006-01-25 10:25 UTC
From: brage at zoo dot uib dot no Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4.4.2 OS: FreeBSD 5.4-STABLE AMD64
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: brage at zoo dot uib dot no
New email:
PHP Version: OS:

 

 [2006-01-24 16:18 UTC] brage at zoo dot uib dot no
Description:
------------
I am experiencing exactly the same problem as described in 
Bug #34892 (Process hang on LDAP operations).

The system is
 - FreeBSD 5.4-STABLE AMD64 (SMP)
 - OpenLDAP Client libraries 2.2.30
 - PHP 4.4.2 

On ldap_bind() the system goes into a select-loop and uses all available cpu until timeout.

The problem is only present when I have many open virtual servers, if I reduce the number of active virtualhosts the problem disappears.  The CLI version also works fine.


Reproduce code:
---------------
See bug #34892.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-24 16:20 UTC] sniper@php.net
It's just your server hitting it's limit..
 [2006-01-24 17:32 UTC] brage at zoo dot uib dot no
That does not seem likely.

It is reproducible with an apache process serving no other request than a single request to the test page. Also the number of virtualhosts needed to reproduce the problem is fairly low ( < 15, but with own log files). 

A ktrace of the request gives a 1.3GB kdump file with 8 million  select()-calls before the request dies from a timeout after 60 seconds.
 [2006-01-25 10:07 UTC] brage at zoo dot uib dot no
The problem seems to be related to the number of open files. 
The following script will use all available cpu and never finish if run with the cli version. If I reduce the number of open files to 20 it will bind sucessfully immediately.

<?php
$ldap_uri = 'removed';
$ldap_dn = 'removed';

for($i = 1; $i <= 20; $i++)
  $files[] = tmpfile();

$ds = ldap_connect($ldap_uri);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

if($bind = ldap_bind($ds,$ldap_rdn))
  print "Success\n";
else
  print "Failure\n";

foreach($files as $file)
  fclose($file);
?>

It is likely that the bug is in openldap and not in PHP. AFAICS it is the call to ldap_bind_s() in php-4.4.2/ext/ldap/ldap.c which never finishes.
 [2006-01-25 10:09 UTC] brage at zoo dot uib dot no
Sorry, the bug-reproducing code should have $i <= 30, not 20.
 [2006-01-25 10:16 UTC] sniper@php.net
It's either openldap bug or you're just running out of file-descriptors on your server. Definately not PHP bug. (I can't even reproduce it myself)

 [2006-01-25 10:25 UTC] brage at zoo dot uib dot no
Definitely not file descriptors (which has a limit > 10000). 

And it is not reproducible on all systems. The other bug report (#34892) is from a similar system to mine, suggesting that the bug might be a 64bit-related issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 22:01:31 2024 UTC