php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68107 php-cgi.exe is getting hung intermittently
Submitted: 2014-09-26 12:48 UTC Modified: 2015-02-03 23:16 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: rohithkrajan at gmail dot com Assigned: ericsten (profile)
Status: Closed Package: WinCache (PECL)
PHP Version: master-Git-2014-09-26 (Git) OS: windows server 2012
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rohithkrajan at gmail dot com
New email:
PHP Version: OS:

 

 [2014-09-26 12:48 UTC] rohithkrajan at gmail dot com
Description:
------------
IS 8.5 +php 5.4.25

when the request comes to IIS,I see that it is getting queued.Fast cgi is trying to spawn a new php-cgi.exe process but i see following pattern of hang in the process monitor trace


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

We can see the php-cgi.exe succesfully loaded the odbcint.dll(process monitor trace shows a success) after this we are not seeing any activity in the php-cgi.exe process.

hang dump shows two threads running both with same stack as shown below



013df45c 1000783f KERNELBASE!WaitForSingleObject+0x12 
03 013df58c 10005594 php_wincache!aplist_ocache_initialize(struct aplist_context * plcache = 0x01832c18, int resnumber = 0n0, unsigned int size = 0x60)+0xff [c:\php-sdk\php54dev\vc9\x86\pecl\wincache\wincache_aplist.c @ 1116]
04 013df624 72efa6ed php_wincache!zm_startup_wincache(int type = 0n1, int module_number = 0n37)+0x3f4 [c:\php-sdk\php54dev\vc9\x86\pecl\wincache\php_wincache.c @ 790]
05 013df640 72e7a2fb php5!zend_startup_module_ex(struct _zend_module_entry * module = 0x00000001)+0x4d [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\zend\zend_api.c @ 1696]
06 013df654 72f0f050 php5!zend_hash_apply(struct _hashtable * ht = 0x00000009, <function> * apply_func = 0x0169a310)+0x1b [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\zend\zend_hash.c @ 716]
07 013df674 72f00617 php5!zend_startup_modules(void)+0x20 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\zend\zend_api.c @ 1823]
08 013df948 00bd2af2 php5!php_module_startup(struct _sapi_module_struct * sf = 0x0000676e, struct _zend_module_entry * additional_modules = 0x00000000, unsigned int num_additional_modules = 0xd535f4d)+0x647 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\main\main.c @ 2223]
09 013df958 00bd1ac9 php_cgi!php_cgi_startup(struct _sapi_module_struct * sapi_module = 0x013dfa90)+0x12 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\sapi\cgi\cgi_main.c @ 937]
0a 013dfae4 00bd38d1 php_cgi!main(int argc = 0n1, char ** argv = 0x01512c28)+0x1a9 [c:\php-sdk\php54dev\vc9\x86\php-5.4.25\sapi\cgi\cgi_main.c @ 1911]
0b 013dfb28 7702495d php_cgi!__tmainCRTStartup(void)+0x10f [f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 586]

other stack is showing 


02 033ffe68 7702495d php_wincache!change_notification_thread(void * parg = 0x00000000)+0x37 [c:\php-sdk\php54dev\vc9\x86\pecl\wincache\wincache_fcnotify.c @ 82]

not sure what is causing the php-cgi.exe process to get hung right after loading odbcnt.dll. I am seeing all the php-cgi.exe process getting hung with the same behavior.Killing all the php-cgi process will get back everything up.

synced source code 1.3.6.1(may be incorrect as the wincache version in the dump showed 1.3.4.0)

and  it is executing on "goto Finished" line 

/* First process reaching here will set all ocacheval to 0 if required */
        /* Even with manual reset and initial state not set */
        hfirst = CreateEvent(NULL, TRUE, FALSE, evtname);
        if(hfirst == NULL)
        {
            result = FATAL_APLIST_INIT_EVENT;
            goto Finished;
        }






Test script:
---------------
Issue is intermittent,unable to reproduce


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-10 17:08 UTC] ericsten@php.net
Please pick up 1.3.6.2, which has a fix for this issue.

Additionally, 1.3.6.2 adds a new setting that can be used to disable Shared Reader/Writer (SRW) locks.  By default, WinCache uses SRW locks.  Disabling them will incur a slight performance hit, but is robust against byzantine failures where php-cgi.exe instances get killed while WinCache is holding a shared lock.  The new php.ini setting is:

wincache.srwlocks=0 ; default is 1.

1.3.6.2 is available out on SourceForge in the developer releases folder.

Thx!
    --E.
 [2014-10-10 17:09 UTC] ericsten@php.net
-Assigned To: +Assigned To: ericsten
 [2015-02-03 23:16 UTC] ericsten@php.net
-Status: Assigned +Status: Closed
 [2015-02-03 23:16 UTC] ericsten@php.net
Current version of WinCache (1.3.7.1) has many fixes to crashes.  Also, changes to avoid deadlocks during startup path was added to WinCache 1.3.6.2, and are carried forward to 1.3.7.1.  This issue should now be resolved.
Please keep an eye on the php_errors.log file; WinCache now emits messages when there are failures in this startup path.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 13:01:27 2024 UTC