skip to Main Content

I have some PHP processes that run using the CLI through Windows scheduled tasks. Sometimes, and this is entirely inconsistent, the process just hangs and I can see it just sit in Task Manager and it doesn’t go away unless I kill it. This is not process specific, I have multiple different scripts that I run and it happens with different ones (though they do use the same bootstrapping logic). I got a dump file of the processes that hang and analyzed using WinDbg, this is the output:

*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************


KEY_VALUES_STRING: 1

    Key  : Analysis.CPU.mSec
    Value: 624

    Key  : Analysis.Elapsed.mSec
    Value: 614

    Key  : Analysis.IO.Other.Mb
    Value: 0

    Key  : Analysis.IO.Read.Mb
    Value: 0

    Key  : Analysis.IO.Write.Mb
    Value: 0

    Key  : Analysis.Init.CPU.mSec
    Value: 484

    Key  : Analysis.Init.Elapsed.mSec
    Value: 5738

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 89

    Key  : Failure.Bucket
    Value: BREAKPOINT_80000003_ucrtbase.dll!__acrt_GetLocaleInfoEx

    Key  : Failure.Hash
    Value: {50a4c54f-0429-0e88-176f-e4eb212d4df5}

    Key  : Timeline.OS.Boot.DeltaSec
    Value: 488312

    Key  : Timeline.Process.Start.DeltaSec
    Value: 59154

    Key  : WER.OS.Branch
    Value: rs5_release

    Key  : WER.OS.Version
    Value: 10.0.17763.1

    Key  : WER.Process.Version
    Value: 8.1.6.0


FILE_IN_CAB:  php2.DMP

NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 0000000000000000
   ExceptionCode: 80000003 (Break instruction exception)
  ExceptionFlags: 00000000
NumberParameters: 0

FAULTING_THREAD:  00000410

PROCESS_NAME:  php.exe

ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION}  Breakpoint  A breakpoint has been reached.

EXCEPTION_CODE_STR:  80000003

STACK_TEXT:  
000000b3`f8dfd3e8 00007ffc`9bd19107     : 00000000`00000000 00000000`000000c0 00000000`00000000 000001ff`e0620000 : ntdll!NtOpenKey+0x14
000000b3`f8dfd3f0 00007ffc`9bd1b682     : 000001ff`e0493214 00000000`00000000 00000000`ea0158fc 00000000`00000000 : KERNELBASE!GetLCIDFromTransientLanguageKey+0x77
000000b3`f8dfd6e0 00007ffc`9bd21de1     : 000001ff`e0493214 000000b3`f8dfe510 00000000`00000000 00000000`00000000 : KERNELBASE!CreateTransientLocales+0x202
000000b3`f8dfddd0 00007ffc`9bd3686a     : 00000000`00000000 00000000`00000000 00000000`00000078 000000b3`f8dfe510 : KERNELBASE!MakeNamedLocaleHashNode+0x141
000000b3`f8dfe2c0 00007ffc`9cdbbcdc     : 00000000`00000000 000000b3`f8dfe390 00007ffc`9ce0bf50 00000000`00000000 : KERNELBASE!GetLocaleInfoEx+0x24a
000000b3`f8dfe310 00007ffc`9ce0bfa9     : 000001ff`e0637cd8 000000b3`f8dfe4e0 00000000`00000001 00000000`00000000 : ucrtbase!__acrt_GetLocaleInfoEx+0x5c
000000b3`f8dfe360 00007ffc`9bd3b201     : 00000000`00000002 00000000`00001000 00000000`00000001 00000000`00001000 : ucrtbase!LanguageEnumProcEx+0x59
000000b3`f8dfe4a0 00007ffc`9bd93ec3     : 00000000`00000000 000001ff`e0637cd8 00000000`00000000 00007ffc`9fcbe9c0 : KERNELBASE!Internal_EnumSystemLocales+0x2f1
000000b3`f8dfe860 00007ffc`9ce0964a     : 000000b3`f8dfe9b0 00007ffc`9fc7b3d2 000091e3`af7a2f63 00000000`00000000 : KERNELBASE!EnumSystemLocalesEx+0x23
000000b3`f8dfe8a0 00007ffc`9ce0bc27     : 00007ffc`9ce0bf50 000001ff`00000001 00000000`0000ff9f 00000000`00000005 : ucrtbase!_acrt_EnumSystemLocalesEx+0x11e
000000b3`f8dfe8f0 00007ffc`9cdf23a8     : 000001ff`e0637f30 000001ff`e0637f30 000000b3`f8dfe9d0 00000000`00000004 : ucrtbase!GetLocaleNameFromLanguage+0x4b
000000b3`f8dfe920 00007ffc`9cdabb8e     : 000001ff`e0637f30 00000000`00000007 000000b3`f8dfec30 000001ff`e0637f30 : ucrtbase!__acrt_get_qualified_locale+0x376b8
000000b3`f8dfe980 00007ffc`9cdba094     : 000001ff`e05cbdc0 000001ff`e0641dd0 000001ff`e0641dd0 000000b3`f8dfedc8 : ucrtbase!_expandlocale+0x2ae
000000b3`f8dfebf0 00007ffc`9cda95a7     : 000001ff`e0665260 ffffffff`ffffffff 00000000`00000bd6 000001ff`e0641dd0 : ucrtbase!_wsetlocale_set_cat+0x5c
000000b3`f8dfef60 00007ffc`9cda8d2a     : 00000000`00000030 000001ff`e0530cc0 00007ffc`9ce595a0 000000b3`f8dff250 : ucrtbase!_wsetlocale_nolock+0x117
000000b3`f8dff1b0 00007ffc`9cda8bfb     : 00000000`00000000 00000000`00000158 00000000`00000008 00000000`00000000 : ucrtbase!<lambda_ffc046909424fd52df0ac47e64813305>::operator()+0x3a
000000b3`f8dff200 00007ffc`9cda8bac     : 000000b3`f8dff201 00000000`00000000 000091e3`af7a35f3 000000b3`f8dff290 : ucrtbase!__crt_seh_guarded_call<void>::operator()<<lambda_1d892b297fdedeee07ed8124eeb2f2fa>,<lambda_ffc046909424fd52df0ac47e64813305> & __ptr64,<lambda_01a7098693036236037e7cdb9bca3d73> >+0x3b
000000b3`f8dff230 00007ffc`9cda8b11     : 000001ff`00000004 00000000`00000004 000000b3`f8dff2f0 00007ffc`9ce8a0b0 : ucrtbase!<lambda_2a444430fde8c29194d880d93eed5e8f>::operator()+0x80
000000b3`f8dff290 00007ffc`9cda8535     : 00000000`00000006 000000b3`f8dff309 00000000`00000000 000000b3`f8dff2f0 : ucrtbase!__crt_seh_guarded_call<void>::operator()<<lambda_7f2adfce497ff2baa965cd4f576ecfd1>,<lambda_2a444430fde8c29194d880d93eed5e8f> & __ptr64,<lambda_8dff2cf36a5417162780cd64fa2883ef> & __ptr64>+0x15
000000b3`f8dff2c0 00007ffc`9cda7b5b     : 00000000`00000002 000001ff`e0641dd0 000001ff`e0637c40 00007ff6`cfbe0040 : ucrtbase!_wsetlocale+0x175
000000b3`f8dff370 00007ffc`9cda7a6f     : 000001ff`e0641dd0 00007ffc`8464d75f 00000000`0000a000 00000000`00000008 : ucrtbase!<lambda_082c17da81b0962e08c0587ee0fac50c>::operator()+0xbb
000000b3`f8dff410 00007ffc`9cda7a27     : 00007ff6`cfbe0140 00000000`00000000 00000000`00000000 000000b3`f8dff490 : ucrtbase!__crt_seh_guarded_call<char * __ptr64>::operator()<<lambda_9bd929c17696992ce54f1d748594fc62>,<lambda_082c17da81b0962e08c0587ee0fac50c> & __ptr64,<lambda_9c08ac857f4975304d44e9f601d9b878> >+0x3b
000000b3`f8dff440 00007ffc`84b71e46     : 00000000`00000002 00007ffc`84d5bba0 00000000`00000004 00000000`00000004 : ucrtbase!setlocale+0x47
000000b3`f8dff480 00007ffc`84b91328     : 00007ff6`cfbe0140 000000b3`f8dff5b0 00000000`00000000 00000000`00000000 : php8!zend_reset_lc_ctype_locale+0x16
000000b3`f8dff4b0 00007ff6`cfbc17cf     : 00000000`00000000 00000000`00000070 00000000`00000000 00000000`00000000 : php8!php_module_startup+0x248
000000b3`f8dff9a0 00007ff6`cfbc36d3     : 00000000`00000000 00000000`00000000 00000000`00000000 000000b3`f8dffa18 : php!sapi_cli_single_write+0x48f
000000b3`f8dff9d0 00007ff6`cfbcc528     : 00000000`00000000 00000000`00000000 000001ff`e0625ae0 00000000`00000000 : php!sapi_cli_single_write+0x2393
000000b3`f8dffbf0 00007ffc`9ee37ac4     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : php!make_fcontext+0x5a8
000000b3`f8dffc30 00007ffc`9fcca4e1     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x14
000000b3`f8dffc60 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21


STACK_COMMAND:  ~0s; .ecxr ; kb

SYMBOL_NAME:  ucrtbase!__acrt_GetLocaleInfoEx+5c

MODULE_NAME: ucrtbase

IMAGE_NAME:  ucrtbase.dll

FAILURE_BUCKET_ID:  BREAKPOINT_80000003_ucrtbase.dll!__acrt_GetLocaleInfoEx

OS_VERSION:  10.0.17763.1

BUILDLAB_STR:  rs5_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

IMAGE_VERSION:  10.0.17763.1490

FAILURE_ID_HASH:  {50a4c54f-0429-0e88-176f-e4eb212d4df5}

Followup:     MachineOwner

So it appears it exits PHP upon calling zend_reset_lc_ctype_locale and at that point it’s in ucrtbase, which is at the Windows level.

I’m running PHP 8.1.6 and also tested running on PHP 8.1.24, got the same result.

UPDATE: adding some requested command output from WinDbg

0:000> !runaway
 User Mode Time
  Thread       Time
    0:36a8     0 days 0:06:10.906
    1:3e80     0 days 0:00:00.000
0:000> .time
Debug session time: Thu Oct 26 16:02:51.000 2023 (UTC - 4:00)
System Uptime: 9 days 0:29:11.102
Process Uptime: 0 days 2:14:59.000
  Kernel time: 0 days 1:50:56.000
  User time: 0 days 0:06:10.000
0:000> ~*k

.  0  Id: 3910.36a8 Suspend: 0 Teb: 00000071`f9aa7000 Unfrozen
 # Child-SP          RetAddr               Call Site
00 00000071`fdbfd628 00007ffd`f4cb9107     ntdll!NtOpenKey+0x14
01 00000071`fdbfd630 00007ffd`f4cbb682     KERNELBASE!GetLCIDFromTransientLanguageKey+0x77
02 00000071`fdbfd920 00007ffd`f4cc1de1     KERNELBASE!CreateTransientLocales+0x202
03 00000071`fdbfe010 00007ffd`f4cd686a     KERNELBASE!MakeNamedLocaleHashNode+0x141
04 00000071`fdbfe500 00007ffd`f5c8bcdc     KERNELBASE!GetLocaleInfoEx+0x24a
05 00000071`fdbfe550 00007ffd`f5cdbfa9     ucrtbase!__acrt_GetLocaleInfoEx+0x5c
06 00000071`fdbfe5a0 00007ffd`f4cdb201     ucrtbase!LanguageEnumProcEx+0x59
07 00000071`fdbfe6e0 00007ffd`f4d33ec3     KERNELBASE!Internal_EnumSystemLocales+0x2f1
08 00000071`fdbfeaa0 00007ffd`f5cd964a     KERNELBASE!EnumSystemLocalesEx+0x23
09 00000071`fdbfeae0 00007ffd`f5cdbc27     ucrtbase!_acrt_EnumSystemLocalesEx+0x11e
0a 00000071`fdbfeb30 00007ffd`f5cc23a8     ucrtbase!GetLocaleNameFromLanguage+0x4b
0b 00000071`fdbfeb60 00007ffd`f5c7bb8e     ucrtbase!__acrt_get_qualified_locale+0x376b8
0c 00000071`fdbfebc0 00007ffd`f5c8a094     ucrtbase!_expandlocale+0x2ae
0d 00000071`fdbfee30 00007ffd`f5c795a7     ucrtbase!_wsetlocale_set_cat+0x5c
0e 00000071`fdbff1a0 00007ffd`f5c78d2a     ucrtbase!_wsetlocale_nolock+0x117
0f 00000071`fdbff3f0 00007ffd`f5c78bfb     ucrtbase!<lambda_ffc046909424fd52df0ac47e64813305>::operator()+0x3a
10 00000071`fdbff440 00007ffd`f5c78bac     ucrtbase!__crt_seh_guarded_call<void>::operator()<<lambda_1d892b297fdedeee07ed8124eeb2f2fa>,<lambda_ffc046909424fd52df0ac47e64813305> & __ptr64,<lambda_01a7098693036236037e7cdb9bca3d73> >+0x3b
11 00000071`fdbff470 00007ffd`f5c78b11     ucrtbase!<lambda_2a444430fde8c29194d880d93eed5e8f>::operator()+0x80
12 00000071`fdbff4d0 00007ffd`f5c78535     ucrtbase!__crt_seh_guarded_call<void>::operator()<<lambda_7f2adfce497ff2baa965cd4f576ecfd1>,<lambda_2a444430fde8c29194d880d93eed5e8f> & __ptr64,<lambda_8dff2cf36a5417162780cd64fa2883ef> & __ptr64>+0x15
13 00000071`fdbff500 00007ffd`f5c77b5b     ucrtbase!_wsetlocale+0x175
14 00000071`fdbff5b0 00007ffd`f5c77a6f     ucrtbase!<lambda_082c17da81b0962e08c0587ee0fac50c>::operator()+0xbb
15 00000071`fdbff650 00007ffd`f5c77a27     ucrtbase!__crt_seh_guarded_call<char * __ptr64>::operator()<<lambda_9bd929c17696992ce54f1d748594fc62>,<lambda_082c17da81b0962e08c0587ee0fac50c> & __ptr64,<lambda_9c08ac857f4975304d44e9f601d9b878> >+0x3b
16 00000071`fdbff680 00007ffd`b3807bd6     ucrtbase!setlocale+0x47
17 00000071`fdbff6c0 00007ffd`b38273a8     php8!zend_reset_lc_ctype_locale+0x16
18 00000071`fdbff6f0 00007ff6`db6017cf     php8!php_module_startup+0x248
19 00000071`fdbffbe0 00007ff6`db6036d3     php!sapi_cli_single_write+0x48f
1a 00000071`fdbffc10 00007ff6`db60c588     php!sapi_cli_single_write+0x2393
1b 00000071`fdbffe30 00007ffd`f6a37ac4     php!make_fcontext+0x5a8
1c 00000071`fdbffe70 00007ffd`f8c0a4e1     kernel32!BaseThreadInitThunk+0x14
1d 00000071`fdbffea0 00000000`00000000     ntdll!RtlUserThreadStart+0x21

   1  Id: 3910.3e80 Suspend: 0 Teb: 00000071`f9aad000 Unfrozen
 # Child-SP          RetAddr               Call Site
00 00000071`83fff3f8 00007ffd`f8c0e9c3     ntdll!NtWaitForAlertByThreadId+0x14
01 00000071`83fff400 00007ffd`f8c0e8b6     ntdll!RtlpWaitOnAddressWithTimeout+0x43
02 00000071`83fff430 00007ffd`f8c0e72d     ntdll!RtlpWaitOnAddress+0xae
03 00000071`83fff4a0 00007ffd`f8bc449c     ntdll!RtlpWaitOnCriticalSection+0xd9
04 00000071`83fff510 00007ffd`f8bc43b0     ntdll!RtlpEnterCriticalSectionContended+0xdc
05 00000071`83fff540 00007ffd`f5c76416     ntdll!RtlEnterCriticalSection+0x40
06 00000071`83fff570 00007ffd`f5c7636b     ucrtbase!__crt_seh_guarded_call<void>::operator()<<lambda_aa87e3671a710a21b5dc78c0bdf72e11>,<lambda_92619d2358a28f41a33ba319515a20b9> & __ptr64,<lambda_6992ecaafeb10aed2b74cb1fae11a551> >+0x32
07 00000071`83fff5a0 00007ffd`f5c7628d     ucrtbase!construct_ptd+0xb7
08 00000071`83fff5e0 00007ffd`f5c81ee1     ucrtbase!construct_ptd_array+0x29
09 00000071`83fff610 00007ffd`f8bd5d37     ucrtbase!DllMainDispatch+0xa9
0a 00000071`83fff640 00007ffd`f8bd36c6     ntdll!LdrpCallInitRoutine+0x6f
0b 00000071`83fff6b0 00007ffd`f8c28745     ntdll!LdrpInitializeThread+0x15a
0c 00000071`83fff790 00007ffd`f8c28323     ntdll!LdrpInitialize+0x409
0d 00000071`83fff830 00007ffd`f8c282ce     ntdll!LdrpInitialize+0x3b
0e 00000071`83fff860 00000000`00000000     ntdll!LdrInitializeThunk+0xe

2

Answers


  1. As already mentioned by you this is not an PHP than more an Windows issue.

    The ucrtbase.dll is part of the c++ redistributables. You could try to fix it by going to: Control Panel -> programs and features.

    Then select all c++ redistributables: Right click -> modify -> repair

    This should do the job. Good luck.

    Login or Signup to reply.
  2. Windows just isn’t great environment for php development or hosting.
    You could use wsl2 or docker to avoid ongoing environment issues.

    https://hub.docker.com/_/php

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search