From:             jason at mugfu dot com
Operating system: FreeBSD 6.0 RC1
PHP version:      5.0.5
PHP Bug Type:     LDAP related
Bug description:  Process hang on LDAP operations

Description:
------------
Environment:

- FreeBSD 6.0 RC-1 on AMD64
- OpenLDAP2.2 client libraries on php host
- Connecting to OpenLDAP2.3 on remote host.

When this script is run from the command line, the LDAP operations
complete very quickly, without any problem.  When executed via mod_php in
Apache2, the php process will timeout everytime.  I have enabled full
debug tracing on in the LDAP server (OpenLDAP).  It shows the result being
sent back to the client, but the client does not close the connection.  CPU
usage on the httpd process handling the web client goes to 100%. 
ktrace/kdump show the process to be caught in a continuous loop like
this:

 69111 httpd    CALL  select(0x400,0x9e1d00,0x9e1d80,0,0)
 69111 httpd    RET   select 1


Reproduce code:
---------------
Short script:
<?php
error_reporting(E_ALL);

$ds=ldap_connect("192.168.1.11");
echo "connect result is " . $ds . "<br />\n";

if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
   echo "Using LDAPv3<br/>\n";
} else {
   echo "Failed to set protocol version to 3<br/>\n";
}

//Anonymous bind:
$r=ldap_bind($ds);
echo "Bind result is " . $r . "<br />\n";

$sr=ldap_search($ds, "dc=mydomain,dc=com", "(&(objectclass=*))");
echo "Number of entires returned is " . ldap_count_entries($ds, $sr) .
"<br />\n";

ldap_close($ds);
?>


Expected result:
----------------
I would expect the command line version, and the version running via
mod_php to behave in the same fashion.

Actual result:
--------------
Process timeouts without any other error.  Note that ldap_connect and
ldap_set_option behave fine in both environments (I may be wrong, but I
don't believe those actually open connections).  It is ldap_bind and
ldap_search that cause the issue.  If I comment out ldap_bind, the process
hangs on ldap_search.

-- 
Edit bug report at http://bugs.php.net/?id=34892&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34892&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34892&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34892&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34892&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34892&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34892&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34892&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34892&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34892&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34892&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34892&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34892&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34892&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34892&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34892&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34892&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34892&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34892&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34892&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34892&r=mysqlcfg

Reply via email to