PHP on EC2 hangs

New WinDBG call stack. It seems to be related to MySQL.

--- UPDATE ---

On Windows Server 2012, using Java 7 and PHP 5.3.29 on Amazon EC2, I run a Java program that runs a fairly simple PHP script for me (can't show it as it depends on multiple dependencies - a lot of code). The PHP script just gets something from mysql and sends me an email if something goes wrong.

This PHP script won't exit! I call exit (); at the end of the PHP file. The Java code that runs this as a sub-process redirects the error stream to the input stream, so there is no infamous buffer lock to continue. Procmon does not show any PHP.exe activity.

Process image (about 2 hours - 4:51 UTC):

enter image description here

Image showing 0 CPU usage:

enter image description here

Image showing that the process only took about 1 second:

enter image description here

The last picture worries me the most, my scripts last about 10 seconds, not less than 1 second!

Process Explorer PHP.exe:

ntoskrnl.exe!KeSynchronizeExecution+0x2246
ntoskrnl.exe!KeRemoveQueueEx+0x108e
ntoskrnl.exe!KeRemoveQueueEx+0xae9
ntoskrnl.exe!KeWaitForMutexObject+0x22a
ntoskrnl.exe!KeSetBasePriorityThread+0x4ec
ntoskrnl.exe!KeRemoveQueueEx+0x281d
ntoskrnl.exe!KeRemoveQueueEx+0x121a
ntoskrnl.exe!KeRemoveQueueEx+0xae9
ntoskrnl.exe!KeWaitForMutexObject+0x22a
ntoskrnl.exe!NtWaitForSingleObject+0xb2
ntoskrnl.exe!setjmpex+0x34b3
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x598
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x3e4
wow64.dll!Wow64LdrpInitialize+0x22e
wow64.dll!Wow64LdrpInitialize+0x172
ntdll.dll!LdrInitShimEngineDynamic+0x2383
ntdll.dll!memset+0xf36a
ntdll.dll!LdrInitializeThunk+0xe
ntdll.dll!ZwWaitForSingleObject+0xc
mswsock.dll!NSPStartup+0x298
WS2_32.dll!select+0x17d
ntdll.dll!RtlAllocateHeap+0xca

      

The PHP.exe dump file analyzes the call stack:

00 ntdll!NtWaitForSingleObject+0xc
01 mswsock!SockWaitForSingleObject+0x154
02 mswsock!WSPSelect+0x355
03 ws2_32!select+0x17d
04 php5ts!php_poll2+0x1e0
05 php5ts!php_stream_xport_create+0x371e
06 php_openssl!get_module+0x9b39
07 php5ts!php_stream_alloc+0x3f4
08 php5ts!php_stream_fill_read_buffer+0x2a4
0a php5ts!php_mysqlnd_net_network_read_pub+0x4b
0b php5ts!php_mysqlnd_net_receive_pub+0x149
0c php5ts!php_mysqlnd_read_row_ex+0x9c
0d php5ts!php_mysqlnd_rowp_read+0x4d
0e php5ts!php_mysqlnd_res_store_result_fetch_data_pub+0x21f
0f php5ts!php_mysqlnd_res_store_result_pub+0xc0
10 php5ts!php_mysqlnd_conn_store_result_pub+0x160
11 php_mysqli!zif_mysqli_query+0x2e2
12 php5ts!zend_do_fcall_common_helper_SPEC+0x8af
13 php5ts!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0xd
14 php5ts!execute+0x2e8
15 php5ts!zend_execute_scripts+0xfe
16 php5ts!php_execute_script+0x24c
17 php!main+0xc1b
18 php!__tmainCRTStartup+0x10f
19 kernel32!BaseThreadInitThunk+0xe
1a ntdll!__RtlUserThreadStart+0x20
1b ntdll!_RtlUserThreadStart+0x1b

      

Could anyone recommend the next course of action, or have you experienced this before? Thank!

script:

<?php
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
require_once('common.php');
DB::overwriteInstanceWithHost('db'); // exists in hosts
date_default_timezone_set("UTC");
DB::overrideCommonDBWithHost("common.db.com"); // not real, but exists
$fetcher = new DataFetcher();
$weatherData = $fetcher->fetchByLatLng(latHere,longHere);
if($weatherData){
    echo $weatherData->getCity();
} else {
    echo "couldn't get station lat/lng";
}
exit();

      

+3


source to share





All Articles