Edit report at http://bugs.php.net/bug.php?id=51666&edit=1
ID: 51666 User updated by: nathanmlong at gmail dot com Reported by: nathanmlong at gmail dot com Summary: Using crypt() makes Apache hang or crash Status: Bogus Type: Bug Package: Reproducible crash Operating System: Win XP Pro & Storage Server 2003 PHP Version: 5.3.2 New Comment: @pajoye - if it's a duplicate, it adds two pieces of information: 1) This bug applies to Windows as well as Ubuntu 2) In my case, it's not necessary to call crypt() multiple times to have the bug. The scripts where I first noticed it only call crypt() once each. It was only when I began trying to isolate the problem that I made a script that just echoed the results of crypt(), then I reloaded that page rapidly. Previous Comments: ------------------------------------------------------------------------ [2010-04-26 17:19:49] paj...@php.net Duplicate of #51424 ------------------------------------------------------------------------ [2010-04-26 17:18:24] nathanmlong at gmail dot com Additional note from submitter: more discussion of this problem is here: http://stackoverflow.com/questions/2699629/did-i-find-a-bug-in-phps-crypt/2714584#2714584 ------------------------------------------------------------------------ [2010-04-26 17:10:23] nathanmlong at gmail dot com Description: ------------ Several scripts in my PHP app occasionally hang: the page sits there on 'waiting for localhost' and never finishes. I'd guess this happens 3-4 times out of 10. The common element is the usage of crypt() to hash user passwords. The problem happens both on my development machine (Windows XP Professional) and our server (Windows Storage Server 2003). Both are running Apache 2.2.14 (Win32). I created the simple test script below and confirmed that the problem still happens, though I have to rapidly reload the page to reproduce it. $foo = crypt('rasmuslerdorf','r1'); echo $foo; When these pages hang, Apache's server-status page increments the number of requests being processed and decrements the number of idle workers. The requests being processed almost all have a status of 'Sending Reply,' though sometimes for a moment they will show either 'Reading request' or 'keepalive (read).' Eventually, Apache may crash. When it does, the Windows crash report looks something like this: szAppName: httpd.exe szAppVer: 2.2.14.0 szModName: php5ts.dll szModVer: 5.3.1.0 // This report was before I upgraded to PHP 5.3.2, // but that didn't fix it offset: 00a2615 I did not compile PHP myself; I used the zip package. CONFIGURATION Starting from php.ini-development, I made the following changes: short_open_tag = On post_max_size = 30M include_path = "c:\path\to\my\includes\folder" extension_dir = "C:/php/ext" upload_max_filesize = 15M extension=php_mysqli.dll extension=php_pdo_mysql.dll date.timezone = "America/New_York" SMTP = our-server.our-domain.vwpcs.com sendmail_from = ad...@our-domain.com sendmail_path = "C:\usr\lib\sendmail.exe" Test script: --------------- $foo = crypt('rasmuslerdorf','r1'); echo $foo; Expected result: ---------------- I expect it to echo the hashed string and for the page load to complete very quickly. Actual result: -------------- The page frequently (maybe 3 out of 10 rapid reloads) hangs - says 'waiting for localhost' and never completes. (Tested mainly using Google Chrome.) When this happens, I can reload apache's /server-status page and see that the number of requests being processed has gone up and the number of idle workers has gone down. Eventually, Apache may crash. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51666&edit=1