php / php-src

The PHP Interpreter
https://www.php.net
Other
38.11k stars 7.74k forks source link

opcache random error with 8.4.0rc2 [Windows] #16449

Open nono303 opened 4 days ago

nono303 commented 4 days ago

Description

Hi!

I've noticed intermittent errors on 8.4.0rc2 (under windows) that I didn't have with 8.4.0rc1

My use case:

available to detail or perform other tests as needed

PHP Version

PHP 8.4.0-rc2

Operating System

Windows 11 x64 vs17 NTS

iluuu1994 commented 4 days ago

Hi @nono303. There are many changes between RC1 and RC2. It would be helpful if you could extract a crash log.

https://bugs.php.net/bugs-generating-backtrace-win32.php

nono303 commented 4 days ago

I'm already in debug mode and no dmp file were produced

  1. configure

    phpsdk-config_make for 8.4
    configure --disable-cli-win32 --disable-debug --disable-embed --disable-ipv6 --disable-phpdbg --disable-phpdbgs --disable-security-flags --disable-test-ini --enable-debug-pack --enable-fd-setsize=2048 --enable-object-out-dir=../build/ --without-analyzer --without-enchant --without-snmp --without-ldap --without-pgsql --without-uncritical-warn-choke --with-toolset=vs --with-cygwin=C:\sdk\softs\cyg64\bin --with-extra-includes=C:\sdk\release\vs17_x64-avx2\_openssl\openssl\include;C:\sdk\release\vs17_x64-avx2\include;C:\sdk\release\vs17_x64-avx2\_proj\include;C:\sdk\release\vs17_x64-avx2\_gdal\include --with-extra-libs=C:\sdk\release\vs17_x64-avx2\_openssl\openssl\lib;C:\sdk\release\vs17_x64-avx2\lib;C:\sdk\release\vs17_x64-avx2\_proj\lib;C:\sdk\release\vs17_x64-avx2\_gdal\lib --with-mp=16 --enable-mbstring=shared --enable-phar-native-ssl --enable-brotli=shared --enable-com-dotnet=shared --enable-exif=shared --enable-fileinfo=shared --enable-ftp=shared --enable-intl=shared --enable-opcache=shared --enable-pdo=shared --enable-soap=shared --enable-sockets=shared --with-bz2=shared --with-curl=shared --with-iconv=C:\sdk\release\vs17_x64-avx2 --with-mysqli=shared --with-openssl=shared --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-sqlite3=shared --with-tidy=shared --with-xdiff=shared --with-geos=shared --with-sodium=shared --with-xml=shared --enable-xmlreader=shared --enable-xmlwriter=shared --with-simplexml=shared --with-dom=shared --with-iconv=shared --enable-zip=shared --enable-zlib=shared --with-readline=shared --enable-pdo=shared --enable-calendar=shared --enable-ctype=shared --enable-bcmath=shared --with-gd=shared --with-xsl=shared --with-gmp=shared --enable-zstd=shared --with-libxml=shared --with-proj=shared --with-ogr=shared --enable-memcache=shared --with-xdebug=shared --with-xdebug-compression --enable-timezonedb=shared --enable-sync=shared --disable-zts --enable-native-intrinsics=sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2 --enable-sanitizer --with-php-build=C:\sdk\release\vs17_x64-avx2 --with-openssl-argon2 
    PHP Version: 8.4.0RC2
  2. result

C:\sdk\release\vs17_x64-avx2\_php-nts\php-cgi.exe
C:\sdk\release\vs17_x64-avx2\_php-nts\php-cgi.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php.exe
C:\sdk\release\vs17_x64-avx2\_php-nts\php.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php8.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php8.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_bcmath.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_bcmath.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_brotli.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_brotli.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_bz2.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_bz2.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_calendar.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_calendar.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_com_dotnet.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_com_dotnet.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_ctype.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_ctype.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_curl.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_curl.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_dom.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_dom.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_exif.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_exif.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_fileinfo.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_fileinfo.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_ftp.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_ftp.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_gd.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_gd.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_geos.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_geos.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_gmp.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_gmp.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_iconv.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_iconv.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_intl.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_intl.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_mbstring.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_mbstring.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_memcache.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_memcache.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_mysqli.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_mysqli.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_ogr.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_ogr.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_opcache.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_opcache.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_openssl.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_openssl.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_pdo_mysql.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_pdo_mysql.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_pdo_sqlite.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_pdo_sqlite.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_proj.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_proj.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_readline.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_readline.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_simplexml.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_simplexml.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_soap.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_soap.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sockets.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sockets.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sodium.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sodium.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sqlite3.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sqlite3.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sync.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_sync.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_tidy.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_tidy.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_timezonedb.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_timezonedb.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xdebug.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xdebug.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xdiff.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xdiff.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xml.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xml.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xmlreader.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xmlreader.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xmlwriter.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xmlwriter.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xsl.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_xsl.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_zip.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_zip.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_zlib.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_zlib.pdb
C:\sdk\release\vs17_x64-avx2\_php-nts\php_zstd.dll
C:\sdk\release\vs17_x64-avx2\_php-nts\php_zstd.pdb
C:\sdk\release\vs17_x64-avx2\lib\php8.lib
  1. AeDebugger
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
"UserDebuggerHotKey"=dword:00000000
"Auto"="1"
"Debugger"="\"C:\\Program Files\\wscc\\sysinternals\\procdump64.exe\" -accepteula -ma -j \"R:\\procdump\" %ld %ld %p"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\AutoExclusionList]
"DWM.exe"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\ProcDump]
iluuu1994 commented 4 days ago

I can't help with Windows, maybe @cmb69 can?

cmb69 commented 4 days ago

mydomain:C:/serveur/php/php-cgi.exe(39904) exit(-1073741819) communication error

That is a segfault error code; I have no idea why you don't get a crash dump. Maybe register WinDbg as post mortem debugger. Or use VS 2022 to attach to the FCGI PHP processes.

Also, do the crashes happen only with OPcache JIT enabled? If so, which settings do you use (especially, opcache.jit and opcache.jit_buffer_size)?

cmb69 commented 4 days ago

Oh, also try without Xdebug.

nono303 commented 4 days ago

Oh, also try without Xdebug.

Xdebug is not enabled

which settings do you use (especially, opcache.jit and opcache.jit_buffer_size)?

opcache.jit=tracing
opcache.jit_buffer_size=100M
my full opcache config running without problem since PHP 8.1... | Opcode Caching | Up and Running | | ---------------------------- | ------------------------ | | Optimization | Enabled | | SHM Cache | Enabled | | File Cache | Disabled | | JIT | On | | Startup | OK | | Shared memory model | win32 | | Cache hits | 275 | | Cache misses | 20 | | Used memory | 74200008 | | Free memory | 2073283640 | | Wasted memory | 0 | | Interned Strings Used memory | 17347768 | | Interned Strings Free memory | 49761096 | | Cached scripts | 20 | | Cached keys | 59 | | Max keys | 130987 | | OOM restarts | 0 | | Hash keys restarts | 0 | | Manual restarts | 0 | | Start time | 2024-10-15T16:21:36+0200 | | Last restart time | none | | Last force restart time | none | | Directive | Local Value | | ------------------------------------- | ----------------------- | | opcache.blacklist_filename | *no value* | | opcache.cache_id | php8 | | opcache.dups_fix | Off | | opcache.enable | On | | opcache.enable_cli | Off | | opcache.enable_file_override | On | | opcache.error_log | d:/php/logs/opcache.log | | opcache.file_cache | *no value* | | opcache.file_cache_consistency_checks | Off | | opcache.file_cache_fallback | Off | | opcache.file_cache_only | Off | | opcache.file_update_protection | 0 | | opcache.force_restart_timeout | 180 | | opcache.interned_strings_buffer | 64 | | opcache.jit | tracing | | opcache.jit_bisect_limit | 0 | | opcache.jit_blacklist_root_trace | 16 | | opcache.jit_blacklist_side_trace | 8 | | opcache.jit_buffer_size | 100M | | opcache.jit_debug | 0 | | opcache.jit_hot_func | 127 | | opcache.jit_hot_loop | 64 | | opcache.jit_hot_return | 8 | | opcache.jit_hot_side_exit | 8 | | opcache.jit_max_exit_counters | 8192 | | opcache.jit_max_loop_unrolls | 8 | | opcache.jit_max_polymorphic_calls | 2 | | opcache.jit_max_recursive_calls | 2 | | opcache.jit_max_recursive_returns | 2 | | opcache.jit_max_root_traces | 1024 | | opcache.jit_max_side_traces | 128 | | opcache.jit_max_trace_length | 1024 | | opcache.jit_prof_threshold | 0.005 | | opcache.log_verbosity_level | 2 | | opcache.max_accelerated_files | 65535 | | opcache.max_file_size | 0 | | opcache.max_wasted_percentage | 10 | | opcache.memory_consumption | 2048 | | opcache.mmap_base | 0x0000700000000000 | | opcache.opt_debug_level | 0 | | opcache.optimization_level | 0x7FFEBFFF | | opcache.preferred_memory_model | *no value* | | opcache.preload | *no value* | | opcache.protect_memory | Off | | opcache.record_warnings | On | | opcache.restrict_api | *no value* | | opcache.revalidate_freq | 0 | | opcache.revalidate_path | Off | | opcache.save_comments | Off | | opcache.use_cwd | On | | opcache.validate_permission | Off | | opcache.validate_timestamps | On |
cmb69 commented 3 days ago

Okay, can you please try running without OPcache JIT? If that doesn't error we know at least that the issue is JIT related.

Still, we need some crash dump/backtrace (although that might not really help, especially if JIT related).

nono303 commented 1 day ago

Hi @cmb69,

Okay, can you please try running without OPcache JIT?

Good catch! with opcache.jit=disable no more 500 Here is the stack of the Unhandled exception with opcache.jit=tracing

php_opcache!zend_jit_trace_hot_side+0x207:
00007ff8`1bc7f037 492b5068        sub     rdx,qword ptr [r8+68h] ds:000001a4`8b3ac0c0=????????????????
0:000> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

KEY_VALUES_STRING: 1

    Key  : AV.Fault
    Value: Read

    Key  : Analysis.CPU.mSec
    Value: 0

    Key  : Analysis.Elapsed.mSec
    Value: 10326

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

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

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

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

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

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

    Key  : Analysis.Version.DbgEng
    Value: 10.0.27704.1001

    Key  : Analysis.Version.Description
    Value: 10.2408.27.01 amd64fre

    Key  : Analysis.Version.Ext
    Value: 1.2408.27.1

    Key  : Failure.Bucket
    Value: INVALID_POINTER_READ_c0000005_php_opcache.dll!zend_jit_trace_hot_side

    Key  : Failure.Hash
    Value: {748c46ce-0a29-b62d-62e8-16ed729a04fd}

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

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

    Key  : WER.OS.Branch
    Value: ni_release

    Key  : WER.OS.Version
    Value: 10.0.22621.1

    Key  : WER.Process.Version
    Value: 8.4.0.2

FILE_IN_CAB:  php-cgi.exe_241018_185117.dmp

COMMENT:  
*** procdump  -e -w php-cgi
*** Unhandled exception: C0000005.ACCESS_VIOLATION

NTGLOBALFLAG:  0

APPLICATION_VERIFIER_FLAGS:  0

CONTEXT:  (.ecxr)
rax=00007ff81c579480 rbx=000000000000001f rcx=00007ff81bcc9e42
rdx=00007000049b4960 rsi=00000000000002d0 rdi=000000000000009b
rip=00007ff81bc7f037 rsp=000000818cbf7230 rbp=0000000000000000
 r8=000001a48b3ac058  r9=0000700004603f88 r10=0000000000000002
r11=0000000000000000 r12=000000000000001f r13=00000000000004d8
r14=00007ff81bcce7c0 r15=000001a48a2166b0
iopl=0         nv up ei ng nz na pe cy
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010281
php_opcache!zend_jit_trace_hot_side+0x207:
00007ff8`1bc7f037 492b5068        sub     rdx,qword ptr [r8+68h] ds:000001a4`8b3ac0c0=????????????????
Resetting default scope

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ff81bc7f037 (php_opcache!zend_jit_trace_hot_side+0x0000000000000207)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000000
   Parameter[1]: 000001a48b3ac0c0
Attempt to read from address 000001a48b3ac0c0

PROCESS_NAME:  php-cgi.exe

READ_ADDRESS:  000001a48b3ac0c0 

ERROR_CODE: (NTSTATUS) 0xc0000005 - L'instruction   0x%p emploie l'adresse m moire 0x%p. L' tat de la m moire ne peut pas  tre %s.

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  0000000000000000

EXCEPTION_PARAMETER2:  000001a48b3ac0c0

STACK_TEXT:  
00000081`8cbf7230 00007ff8`1bc7fc4c     : 000001a4`8a3f69b8 000001a4`8a3ac4c0 ffffffff`ffffffff 00000000`0000001f : php_opcache!zend_jit_trace_hot_side+0x207
00000081`8cbfb2f0 00007000`800005a1     : 00000000`0000001f 000001a4`000000c0 00000000`0000000b 00007000`05030aa0 : php_opcache!zend_jit_trace_exit+0x82c
00000081`8cbfb390 00000000`0000001f     : 000001a4`000000c0 00000000`0000000b 00007000`05030aa0 00000000`00000016 : 0x00007000`800005a1
00000081`8cbfb398 000001a4`000000c0     : 00000000`0000000b 00007000`05030aa0 00000000`00000016 00007000`800399e8 : 0x1f
00000081`8cbfb3a0 00000000`0000000b     : 00007000`05030aa0 00000000`00000016 00007000`800399e8 00000000`000000fd : 0x000001a4`000000c0
00000081`8cbfb3a8 00007000`05030aa0     : 00000000`00000016 00007000`800399e8 00000000`000000fd 00000000`000000fd : 0xb
00000081`8cbfb3b0 00000000`00000016     : 00007000`800399e8 00000000`000000fd 00000000`000000fd 00000081`8cbfb4c0 : 0x00007000`05030aa0
00000081`8cbfb3b8 00007000`800399e8     : 00000000`000000fd 00000000`000000fd 00000081`8cbfb4c0 00000000`00000000 : 0x16
00000081`8cbfb3c0 00000000`000000fd     : 00000000`000000fd 00000081`8cbfb4c0 00000000`00000000 000001a4`8a27c000 : 0x00007000`800399e8
00000081`8cbfb3c8 00000000`000000fd     : 00000081`8cbfb4c0 00000000`00000000 000001a4`8a27c000 000001a4`8a27c000 : 0xfd
00000081`8cbfb3d0 00000081`8cbfb4c0     : 00000000`00000000 000001a4`8a27c000 000001a4`8a27c000 00007000`0502df80 : 0xfd
00000081`8cbfb3d8 00000000`00000000     : 000001a4`8a27c000 000001a4`8a27c000 00007000`0502df80 000001a4`8a3d88c0 : 0x00000081`8cbfb4c0

STACK_COMMAND:  ~0s; .ecxr ; kb

FAULTING_SOURCE_LINE:  C:\sdk\src\php-sdk\phpmaster\vs17\x64\php-src\ext\opcache\jit\zend_jit_trace.c

FAULTING_SOURCE_FILE:  C:\sdk\src\php-sdk\phpmaster\vs17\x64\php-src\ext\opcache\jit\zend_jit_trace.c

FAULTING_SOURCE_LINE_NUMBER:  8448

FAULTING_SOURCE_CODE:  
No source found for 'C:\sdk\src\php-sdk\phpmaster\vs17\x64\php-src\ext\opcache\jit\zend_jit_trace.c'

SYMBOL_NAME:  php_opcache!zend_jit_trace_hot_side+207

MODULE_NAME: php_opcache

IMAGE_NAME:  php_opcache.dll

FAILURE_BUCKET_ID:  INVALID_POINTER_READ_c0000005_php_opcache.dll!zend_jit_trace_hot_side

OS_VERSION:  10.0.22621.1

BUILDLAB_STR:  ni_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

IMAGE_VERSION:  8.4.0.2

FAILURE_ID_HASH:  {748c46ce-0a29-b62d-62e8-16ed729a04fd}

Followup:     MachineOwner
---------