php-src icon indicating copy to clipboard operation
php-src copied to clipboard

Apache 2.4.53 & PHP 8.1.4 & Laravel 9 access violation in emalloc (Windows/10)

Open MircoBabin opened this issue 4 years ago • 7 comments

Description

I have on my development system an access violation in php8ts.dll. And I don't know where to look for. Loading a simple PHP page works. But loading a page via the Laravel 9 framework crashes.

I have attached the Apache conf and php.ini in Configs.zip.

Summary:

  • I'm upgrading from Laravel 7 & PHP 7.2.31 to Laravel 9 & PHP 8.1.4.
  • I'm using the 32bit thread safe version.
  • I'm running a local development Apache webserver. With the settings:
D:\Projects\bin\apache\bin>httpd -v
Server version: Apache/2.4.53 (Win32)
Apache Lounge VS16 Server built:   Mar 16 2022 10:58:29
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html

LoadModule php_module "d:/projects/bin/php-8.1.4/php8apache2_4.dll"
PHPIniDir "C:/Users/Mirco/AppData/Local/Temp/GitNoob/project-TripPortals/directory-WorkInProgress/php.ini"
<IfModule mpm_winnt_module>
   ThreadStackSize 8388608
</IfModule>
  • When loading the first page from Laravel (which should be the login page) with http://localhost:6001 Apache crashes with:
[Fri Mar 25 14:20:44.318029 2022] [mpm_winnt:notice] [pid 10396:tid 516] AH00428: Parent: child process 11936 exited with status 3221225477 -- Restarting.
  • I attached a VS2015 debugger to the Apache crashing child httpd.exe process. The crash occurs in php8ts.dll function emalloc() line 2541.
Registers

EAX = 00E6EFC0 EBX = 00000004 ECX = 00000001 EDX = 24800040 ESI = 24800040 EDI = 256E8990 EIP = 61104453 ESP = 0491D750 EBP = 0491D758 EFL = 00010202 

0x00000001 = 00000000 


Stacktrace

>	php8ts.dll!emalloc(unsigned int size) Line 2541	C
 	php8ts.dll!zend_compile_if(_zend_ast * ast) Line 5381	C
 	php8ts.dll!zend_compile_stmt(_zend_ast * ast) Line 10006	C
 	php8ts.dll!zend_compile_stmt_list(_zend_ast * ast) Line 6150	C
 	php8ts.dll!zend_compile_stmt(_zend_ast * ast) Line 9966	C
 	php8ts.dll!zend_compile_func_decl(_znode * result, _zend_ast * ast, bool toplevel) Line 7270	C
 	php8ts.dll!zend_compile_stmt(_zend_ast * ast) Line 10018	C
 	php8ts.dll!zend_compile_stmt_list(_zend_ast * ast) Line 6150	C
 	php8ts.dll!zend_compile_stmt(_zend_ast * ast) Line 9966	C
 	php8ts.dll!zend_compile_class_decl(_znode * result, _zend_ast * ast, bool toplevel) Line 7747	C
 	php8ts.dll!zend_compile_top_stmt(_zend_ast * ast) Line 9940	C
 	php8ts.dll!zend_compile_top_stmt(_zend_ast * ast) Line 9929	C
 	php8ts.dll!zend_compile(int type) Line 620	C
 	php8ts.dll!compile_file(_zend_file_handle * file_handle, int type) Line 655	C
 	php8ts.dll!phar_compile_file(_zend_file_handle * file_handle, int type) Line 3351	C
 	php8ts.dll!compile_filename(int type, _zend_string * filename) Line 706	C
 	php8ts.dll!zend_include_or_eval(_zval_struct * inc_filename_zv, int type) Line 4617	C
 	php8ts.dll!ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(_zend_execute_data * execute_data) Line 38538	C
 	php8ts.dll!execute_ex(_zend_execute_data * ex) Line 55210	C
 	php8ts.dll!zend_call_function(_zend_fcall_info * fci, _zend_fcall_info_cache * fci_cache) Line 897	C
 	php8ts.dll!zend_call_known_function(_zend_function * fn, _zend_object * object, _zend_class_entry * called_scope, _zval_struct * retval_ptr, unsigned int param_count, _zval_struct * params, _zend_array * named_params) Line 985	C
 	php8ts.dll!spl_perform_autoload(_zend_string * class_name, _zend_string * lc_name) Line 434	C
 	php8ts.dll!zend_lookup_class_ex(_zend_string * name, _zend_string * key, unsigned int flags) Line 1129	C
 	php8ts.dll!zend_fetch_class_by_name(_zend_string * class_name, _zend_string * key, int fetch_type) Line 1589	C
 	php8ts.dll!ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(_zend_execute_data * execute_data) Line 6778	C
 	php8ts.dll!execute_ex(_zend_execute_data * ex) Line 55210	C
 	php8ts.dll!zend_execute(_zend_op_array * op_array, _zval_struct * return_value) Line 59773	C
 	php8ts.dll!zend_execute_scripts(int type, _zval_struct * retval, int file_count, ...) Line 1759	C
 	php8ts.dll!php_execute_script(_zend_file_handle * primary_file) Line 2538	C
 	php8apache2_4.dll!php_handler(request_rec * r) Line 705	C
 	libhttpd.dll!6243ccf5()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for libhttpd.dll]	
 	libhttpd.dll!6243bf05()	Unknown
 	libhttpd.dll!62438ee5()	Unknown
 	mod_rewrite.so!737f4997()	Unknown
 	libhttpd.dll!6243ccf5()	Unknown
 	libhttpd.dll!6243bf05()	Unknown
 	libhttpd.dll!624390e4()	Unknown
 	libhttpd.dll!62439160()	Unknown
 	libhttpd.dll!624335ab()	Unknown
 	libhttpd.dll!6243efc5()	Unknown
 	libhttpd.dll!6243ee62()	Unknown
 	libhttpd.dll!6244bcd2()	Unknown
 	[External Code]	

image

PHP Version

PHP 8.1.4

Operating System

Windows/10

MircoBabin avatar Mar 25 '22 14:03 MircoBabin

Running the webserver via the Laravel 9 command:

php artisan serve

The issue remains. So it must be a PHP issue and not an Apache issue.

MircoBabin avatar Mar 28 '22 14:03 MircoBabin

Installed XDEBUG.

The xdebug-trace always ends in the Composer autoloader being called.

php.ini adjustments:

[xdebug]
; Install php_xdebug.dll via the instructions at https://xdebug.org/wizard
;
; Uncomment the next line to enable the xdebug extension.
zend_extension=xdebug

xdebug.log="d:/projects/Webpage/tripportals/storage/logs/php-xdebug.log"
xdebug.output_dir="d:/projects/Webpage/tripportals/storage/logs"

xdebug.trace_output_name=php-xdebug-trace.%u.%r
xdebug.start_with_request=yes
xdebug.mode=trace
xdebug.trace_format=0
xdebug.trace_options=0
xdebug.use_compression=false

MircoBabin avatar Mar 28 '22 14:03 MircoBabin

After switching Apache to x64 and using Php 8.1.4 x64 build the issue is resolved. I finally see the application in the browser.

It seems the 32bit Php 8.1.4 distributable is corrupt or something.

MircoBabin avatar Mar 28 '22 14:03 MircoBabin

It seems the 32bit Php 8.1.4 distributable is corrupt or something.

It might be worth investigating this.

cmb69 avatar Mar 28 '22 14:03 cmb69

But loading a page via the Laravel 9 framework crashes.

I cannot reproduce this.

The stack backtrace is unfortunately not as helpful as it could be. You're either missing debug symbols or the PHP sources, or maybe VS 2015 is just too old. Could you please try with VS 2019? See also https://bugs.php.net/bugs-generating-backtrace-win32.php regarding details about the stack backtrace.

cmb69 avatar Mar 28 '22 15:03 cmb69

Sorry, I don't have time to investigate this any further.

That's why I closed it.

MircoBabin avatar Mar 28 '22 15:03 MircoBabin

Well, then I'm going to close.

cmb69 avatar Mar 28 '22 16:03 cmb69