php-cgi.exe间歇性地挂起

时间:2014-09-22 17:49:12

标签: php iis

我一直在解决php-cgi.exe间歇性挂起的问题,无法超过某一点。任何帮助都将不胜感激。

IIS 8.5 + php 5.4.25

当请求来到IIS时,我看到它正在排队。快速cgi正在尝试生成一个新的php-cgi.exe进程,但我在进程监视器跟踪中看到以下挂起模式

8:34:23.0975600 PM        php-cgi.exe        8112       RegOpenKey     HKU\.DEFAULT\SOFTWARE\ODBC\ODBC.INI\ODBC                NAME NOT FOUND         Desired Access: Read     9/20/2014 
8:34:23 PM    00:00:03.3090228              0.0000045                
8:34:23.0975645 PM        Registry                648         Read
8:34:23.0975789 PM        php-cgi.exe        8112       RegQueryKey    HKLM    SUCCESS              Query: HandleTags, HandleTags: 0x0               9/20/2014 
8:34:23 PM    00:00:03.3090417              0.0000019            
8:34:23.0975808 PM                Registry                649         Read
8:34:23.0975891 PM        php-cgi.exe        8112       RegQueryKey    HKLM    SUCCESS              Query: Name     9/20/2014 
8:34:23 PM          00:00:03.3090519              0.0000032                         

8:34:23.0975923 PM        Registry                650         Read
8:34:23.0976035 PM        php-cgi.exe        8112       RegOpenKey                HKLM\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\ODBC          NAME NOT FOUND         Desired Access: Read                9/20/2014 
8:34:23 PM    00:00:03.3090663              0.0000077            
8:34:23.0976112 PM        Registry                651                Read
8:34:23.0980451 PM        php-cgi.exe        8112       CreateFile           C:\Windows\SysWOW64\odbcint.dll      SUCCESS                Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened         9/20/2014 
8:34:23 PM                00:00:03.3095079              0.0000285            
8:34:23.0980736 PM        File System         652         
8:34:23.0981085 PM        php-cgi.exe        8112       QueryBasicInformationFile          C:\Windows\SysWOW64\odbcint.dll                SUCCESS              CreationTime: 8/21/2013 9:16:44 PM, LastAccessTime: 8/21/2013 9:16:44 PM, LastWriteTime: 8/21/2013 9:16:36 PM, ChangeTime: 2/4/2014 7:58:00 PM, FileAttributes: A          9/20/2014 
8:34:23 PM                00:00:03.3095713              0.0000038            
8:34:23.0981123 PM        File System         653         Read Metadata
8:34:23.0981261 PM        php-cgi.exe        8112       CloseFile              C:\Windows\SysWOW64\odbcint.dll      SUCCESS                                9/20/2014 
8:34:23 PM    00:00:03.3095889              0.0000090            
8:34:23.0981351 PM        File System                654         
8:34:23.0983027 PM        php-cgi.exe        8112       CreateFile           C:\Windows\SysWOW64\odbcint.dll      SUCCESS                Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened      9/20/2014 
8:34:23 PM                00:00:03.3097655              0.0000215            
8:34:23.0983242 PM        File System         655         
8:34:23.0983651 PM        php-cgi.exe        8112       CreateFileMapping         C:\Windows\SysWOW64\odbcint.dll      FILE LOCKED WITH ONLY READERS     SyncType: SyncTypeCreateSection, PageProtection:       9/20/2014 
8:34:23 PM                00:00:03.3098279              0.0000032            8:34:23.0983683 PM        File System         656         
8:34:23.0983949 PM        php-cgi.exe        8112       CreateFileMapping         C:\Windows\SysWOW64\odbcint.dll                SUCCESS              SyncType: SyncTypeOther           9/20/2014 
8:34:23 PM    00:00:03.3098577              0.0000016                
8:34:23.0983965 PM        File System         657         
8:34:23.0984397 PM        php-cgi.exe        8112       CloseFile              C:\Windows\SysWOW64\odbcint.dll      SUCCESS                                9/20/2014 8:34:23 PM    00:00:03.3099025              0.0000070            
8:34:23.0984467 PM        File System                658         
8:34:23.0990797 PM        php-cgi.exe        8112       Thread Create                   SUCCESS              Thread ID: 7928 9/20/2014 
8:34:23 PM          00:00:03.3105425              0.0000000            8:34:23.0990797 PM        Process 659         

查看php-cgi.exe内存转储,我看到了

013df45c 1000783f KERNELBASE!WaitForSingleObject+0x12 
013df58c 10005594 php_wincache!aplist_ocache_initialize+0xff [c:\php-    sdk\php54dev\vc9\x86\pecl\wincache\wincache_aplist.c @ 1116]
013df624 72efa6ed php_wincache!zm_startup_wincache+0x3f4 [c:\php-sdk\php54dev\vc9\x86\pecl\wincache\php_wincache.c @ 790]
013df640 72e7a2fb php5!zend_startup_module_ex+0x4d [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\zend\zend_api.c @ 1696]
013df654 72f0f050 php5!zend_hash_apply+0x1b [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\zend\zend_hash.c @ 716]
013df674 72f00617 php5!zend_startup_modules+0x20 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\zend\zend_api.c @ 1823]
013df948 00bd2af2 php5!php_module_startup+0x647 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\main\main.c @ 2223]
013df958 00bd1ac9 php_cgi!php_cgi_startup+0x12 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\sapi\cgi\cgi_main.c @ 937]
013dfae4 00bd38d1 php_cgi!main+0x1a9 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\sapi\cgi\cgi_main.c @ 1911]
013dfb28 7702495d php_cgi!__tmainCRTStartup+0x10f 

我不确定是什么导致php-cgi.exe进程在加载odbc dll后立即挂起。我看到所有的php-cgi.exe进程都挂起了相同的行为。杀死所有的php-cgi进程将取回一切。

1 个答案:

答案 0 :(得分:1)

这是wincache模块中的一个错误。修复程序位于开发人员频道中。

https://bugs.php.net/bug.php?id=68107

从错误:

请选择1.3.6.2,该问题已解决此问题。

此外,1.3.6.2添加了一个新设置,可用于禁用共享读取器/写入器(SRW)锁。默认情况下,WinCache使用SRW锁。禁用它们会导致轻微的性能损失,但是对于拜占庭式的故障是强大的,其中php-cgi.exe实例在WinCache持有共享锁时被杀死。新的php.ini设置是:

wincache.srwlocks = 0;默认值为1。

1.3.6.2在开发者版本文件夹中的SourceForge上可用。

http://sourceforge.net/projects/wincache/files/development/