Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache / PHP segfaults (PHP 8.0 and 8.1, but also 7.4) #8159

Closed
unix-world opened this issue Mar 1, 2022 · 60 comments
Closed

Apache / PHP segfaults (PHP 8.0 and 8.1, but also 7.4) #8159

unix-world opened this issue Mar 1, 2022 · 60 comments

Comments

@unix-world
Copy link

unix-world commented Mar 1, 2022

Description

PHP 7.4.27 / 8.0.15 / 8.1.3
Apache 2.4.52
OpenBSD 7.0 / amd64

If running any of the above PHP versions under Apache (as module), I noticed that every time when apache rotate it's logs it crashes. To be sure of this issue I set the log rotation at a fixed hour (not by size).
In the last 3 days, each day at the exactly same hour apache crashed and did not crashed in the rest.
Finally I did not loaded the opcache.so and it did not crashed on log rotation.
After further investigation I noticed this:

The problem is somwehere in opcache.so.
All the above versions are affected.
The PHP 7.3.33 works OK, it does not crash.

How to reproduce the issue:

  1. load the opcache.so PHP extensions
  2. apachectl2 graceful OR kill -HUP 12345 (where 12345 is the process ID number)
  3. apache crashes

If I do not load opcache.so it does not crashes.

PHP Version

8.0.15

Operating System

OpenBSD 7.0

@devnexen
Copy link
Member

devnexen commented Mar 2, 2022

a backtrace would help, if I recall correctly, openbsd tends to generate a coredump as <process name>.core (so php.core most likely here) where the said process had been called. What might help further in your case eventually is to write to [email protected] so they might help you generate a version with debug symbols so we can get more useful informations. And maybe opcache settings.

@unix-world
Copy link
Author

There is no php.core, only httpd2.core. I tried looking but there are not enough debug symbols within ... perhaps need a binary package with DEBUG=on ...
The opcache settings I excluded since I can switch between PHP 7.3.33 / 7.4.27 / 8.0.15 / 8.1.2 and with the same opcache settings the PHP 7.3.33 is not crashing apache.

This crash is very weird.
If I do 'rcctl restart apache2' it does not crash ... (this is like in linux: systemctl restart apache2'
If I do kill -HUP 12345 (where 12345 is the process ID number) it crashes with a core dump, but only with PHP 7.4 / 8.0 / 8.1 and not with 7.3 ! ... (and only if opcache is loaded as a PHP extension, not in the rest).

@unix-world
Copy link
Author

This is the output of GDB

gdb /usr/local/sbin/httpd2 /httpd2.core

GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd7.0"...(no debugging symbols found)

Core was generated by `httpd2'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libpthread.so.26.1...done.
Loaded symbols for /usr/lib/libpthread.so.26.1
Loaded symbols for /usr/local/sbin/httpd2
Reading symbols from /usr/local/lib/libpcre.so.3.0...done.
Loaded symbols for /usr/local/lib/libpcre.so.3.0
Reading symbols from /usr/local/lib/libaprutil-1.so.6.1...done.
Loaded symbols for /usr/local/lib/libaprutil-1.so.6.1
Symbols already loaded for /usr/lib/libpthread.so.26.1
Reading symbols from /usr/lib/libexpat.so.14.0...done.
Loaded symbols for /usr/lib/libexpat.so.14.0
Reading symbols from /usr/local/lib/libiconv.so.7.0...done.
Loaded symbols for /usr/local/lib/libiconv.so.7.0
Reading symbols from /usr/local/lib/libapr-1.so.7.0...done.
Loaded symbols for /usr/local/lib/libapr-1.so.7.0
Reading symbols from /usr/local/lib/libdb.so.5.0...done.
Loaded symbols for /usr/local/lib/libdb.so.5.0
Reading symbols from /usr/lib/libc.so.96.1...done.
Loaded symbols for /usr/lib/libc.so.96.1
Reading symbols from /usr/libexec/ld.so...Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/libexec/ld.so]
Reading symbols from /usr/local/lib/php-7.4/modules/opcache.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/opcache.so
Reading symbols from /usr/local/lib/apache2/mod_authn_file.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authn_file.so
Reading symbols from /usr/local/lib/apache2/mod_authn_core.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authn_core.so
Reading symbols from /usr/local/lib/apache2/mod_authz_host.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_host.so
Reading symbols from /usr/local/lib/apache2/mod_authz_user.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_user.so
Reading symbols from /usr/local/lib/apache2/mod_authz_core.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_core.so
Reading symbols from /usr/local/lib/apache2/mod_access_compat.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_access_compat.so
Reading symbols from /usr/local/lib/apache2/mod_auth_basic.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_auth_basic.so
Reading symbols from /usr/local/lib/apache2/mod_auth_digest.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_auth_digest.so
Reading symbols from /usr/local/lib/apache2/mod_allowmethods.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_allowmethods.so
Reading symbols from /usr/local/lib/apache2/mod_file_cache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_file_cache.so
Reading symbols from /usr/local/lib/apache2/mod_cache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache.so
Reading symbols from /usr/local/lib/apache2/mod_cache_disk.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache_disk.so
Reading symbols from /usr/local/lib/apache2/mod_cache_socache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache_socache.so
Reading symbols from /usr/local/lib/apache2/mod_socache_shmcb.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_socache_shmcb.so
Reading symbols from /usr/local/lib/apache2/mod_socache_memcache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_socache_memcache.so
Reading symbols from /usr/local/lib/apache2/mod_buffer.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_buffer.so
Reading symbols from /usr/local/lib/apache2/mod_reqtimeout.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_reqtimeout.so
Reading symbols from /usr/local/lib/apache2/mod_request.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_request.so
Reading symbols from /usr/local/lib/apache2/mod_include.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_include.so
Reading symbols from /usr/local/lib/apache2/mod_filter.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_filter.so
Reading symbols from /usr/local/lib/apache2/mod_deflate.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_deflate.so
Reading symbols from /usr/lib/libz.so.6.0...done.
Loaded symbols for /usr/lib/libz.so.6.0
Reading symbols from /usr/local/lib/apache2/mod_mime.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mime.so
Reading symbols from /usr/local/lib/apache2/mod_log_config.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_log_config.so
Reading symbols from /usr/local/lib/apache2/mod_env.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_env.so
Reading symbols from /usr/local/lib/apache2/mod_mime_magic.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mime_magic.so
Reading symbols from /usr/local/lib/apache2/mod_expires.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_expires.so
Reading symbols from /usr/local/lib/apache2/mod_headers.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_headers.so
Reading symbols from /usr/local/lib/apache2/mod_unique_id.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_unique_id.so
Reading symbols from /usr/local/lib/apache2/mod_setenvif.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_setenvif.so
Reading symbols from /usr/local/lib/apache2/mod_version.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_version.so
Reading symbols from /usr/local/lib/apache2/mod_session.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_session.so
Reading symbols from /usr/local/lib/apache2/mod_ssl.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_ssl.so
Reading symbols from /usr/lib/libssl.so.50.0...done.
Loaded symbols for /usr/lib/libssl.so.50.0
Reading symbols from /usr/lib/libcrypto.so.47.0...done.
Loaded symbols for /usr/lib/libcrypto.so.47.0
Reading symbols from /usr/local/lib/apache2/mod_mpm_prefork.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mpm_prefork.so
Reading symbols from /usr/local/lib/apache2/mod_unixd.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_unixd.so
Reading symbols from /usr/local/lib/apache2/mod_dav.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav.so
Reading symbols from /usr/local/lib/apache2/mod_status.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_status.so
Reading symbols from /usr/local/lib/apache2/mod_autoindex.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_autoindex.so
Reading symbols from /usr/local/lib/apache2/mod_dav_fs.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_fs.so
Reading symbols from /usr/local/lib/apache2/mod_dav_lock.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_lock.so
Reading symbols from /usr/local/lib/apache2/mod_vhost_alias.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_vhost_alias.so
Reading symbols from /usr/local/lib/apache2/mod_negotiation.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_negotiation.so
Reading symbols from /usr/local/lib/apache2/mod_dir.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dir.so
Reading symbols from /usr/local/lib/apache2/mod_alias.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_alias.so
Reading symbols from /usr/local/lib/apache2/mod_rewrite.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_rewrite.so
Reading symbols from /usr/local/lib/php-7.4/libphp7.so...done.
Loaded symbols for /usr/local/lib/php-7.4/libphp7.so
Reading symbols from /usr/local/lib/libargon2.so.0.0...done.
Loaded symbols for /usr/local/lib/libargon2.so.0.0
Reading symbols from /usr/lib/libreadline.so.4.0...done.
Loaded symbols for /usr/lib/libreadline.so.4.0
Reading symbols from /usr/lib/libcurses.so.14.0...done.
Loaded symbols for /usr/lib/libcurses.so.14.0
Reading symbols from /usr/local/lib/libintl.so.7.0...done.
Loaded symbols for /usr/local/lib/libintl.so.7.0
Reading symbols from /usr/lib/libm.so.10.1...done.
Loaded symbols for /usr/lib/libm.so.10.1
Reading symbols from /usr/local/lib/libonig.so.7.2...done.
Loaded symbols for /usr/local/lib/libonig.so.7.2
Reading symbols from /usr/local/lib/libsqlite3.so.37.15...done.
Loaded symbols for /usr/local/lib/libsqlite3.so.37.15
Reading symbols from /usr/local/lib/libxml2.so.17.0...done.
Loaded symbols for /usr/local/lib/libxml2.so.17.0
Reading symbols from /usr/local/lib/liblzma.so.2.1...done.
Loaded symbols for /usr/local/lib/liblzma.so.2.1
Reading symbols from /usr/local/lib/php-7.4/modules/bz2.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/bz2.so
Reading symbols from /usr/local/lib/libbz2.so.10.4...done.
Loaded symbols for /usr/local/lib/libbz2.so.10.4
Reading symbols from /usr/local/lib/php-7.4/modules/curl.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/curl.so
Reading symbols from /usr/local/lib/libcurl.so.26.13...done.
Loaded symbols for /usr/local/lib/libcurl.so.26.13
Reading symbols from /usr/local/lib/libnghttp2.so.0.18...done.
Loaded symbols for /usr/local/lib/libnghttp2.so.0.18
Reading symbols from /usr/local/lib/php-7.4/modules/dba.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/dba.so
Reading symbols from /usr/local/lib/libgdbm.so.7.0...done.
Loaded symbols for /usr/local/lib/libgdbm.so.7.0
Reading symbols from /usr/local/lib/php-7.4/modules/gd.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/gd.so
Reading symbols from /usr/local/lib/libpng.so.18.0...done.
Loaded symbols for /usr/local/lib/libpng.so.18.0
Reading symbols from /usr/local/lib/libwebp.so.4.3...done.
Loaded symbols for /usr/local/lib/libwebp.so.4.3
Reading symbols from /usr/local/lib/libjpeg.so.70.0...done.
Loaded symbols for /usr/local/lib/libjpeg.so.70.0
Reading symbols from /usr/X11R6/lib/libfreetype.so.30.0...done.
Loaded symbols for /usr/X11R6/lib/libfreetype.so.30.0
Reading symbols from /usr/local/lib/php-7.4/modules/gmp.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/gmp.so
Reading symbols from /usr/local/lib/libgmp.so.11.0...done.
Loaded symbols for /usr/local/lib/libgmp.so.11.0
Reading symbols from /usr/local/lib/php-7.4/modules/intl.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/intl.so
Reading symbols from /usr/local/lib/libicuio.so.20.0...done.
Loaded symbols for /usr/local/lib/libicuio.so.20.0
Reading symbols from /usr/local/lib/libicui18n.so.20.0...done.
Loaded symbols for /usr/local/lib/libicui18n.so.20.0
Reading symbols from /usr/local/lib/libicuuc.so.20.0...done.
Loaded symbols for /usr/local/lib/libicuuc.so.20.0
Reading symbols from /usr/local/lib/libicudata.so.20.0...done.
Loaded symbols for /usr/local/lib/libicudata.so.20.0
Reading symbols from /usr/lib/libc++.so.8.0...done.
Loaded symbols for /usr/lib/libc++.so.8.0
Reading symbols from /usr/lib/libc++abi.so.5.0...done.
Loaded symbols for /usr/lib/libc++abi.so.5.0
Reading symbols from /usr/local/lib/php-7.4/modules/mongodb.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/mongodb.so
Reading symbols from /usr/lib/libtls.so.22.0...done.
Loaded symbols for /usr/lib/libtls.so.22.0
Reading symbols from /usr/local/lib/php-7.4/modules/mysqli.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/mysqli.so
Reading symbols from /usr/local/lib/php-7.4/modules/pdo_mysql.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/pdo_mysql.so
Reading symbols from /usr/local/lib/php-7.4/modules/pdo_pgsql.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/pdo_pgsql.so
Reading symbols from /usr/local/lib/libpq.so.6.10...done.
Loaded symbols for /usr/local/lib/libpq.so.6.10
Reading symbols from /usr/local/lib/php-7.4/modules/pgsql.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/pgsql.so
Reading symbols from /usr/local/lib/php-7.4/modules/zip.so...done.
Loaded symbols for /usr/local/lib/php-7.4/modules/zip.so
Reading symbols from /usr/local/lib/libzip.so.4.1...done.
Loaded symbols for /usr/local/lib/libzip.so.4.1
#0 0x00000ce72b51aeb0 in ?? ()

There is nothing more ... in the GDB output !

@unix-world
Copy link
Author

Also maybe this can help you:

(gdb) list
1 /usr/src/lib/libtls/tls.c: No such file or directory.
in /usr/src/lib/libtls/tls.c
(gdb) info locals
No symbol table info available.
(gdb) bt
#0 0x000008f23da53eb0 in ?? ()
#1 0x000008f2ef2029e7 in accel_startup () from /usr/local/lib/php-7.4/modules/opcache.so
#2 0x000008f2931d9126 in zend_extension_startup () from /usr/local/lib/php-7.4/libphp7.so
#3 0x000008f2931bbf59 in zend_llist_apply_with_del () from /usr/local/lib/php-7.4/libphp7.so
#4 0x000008f2931d90e5 in zend_startup_extensions () from /usr/local/lib/php-7.4/libphp7.so
#5 0x000008f29315039e in php_module_startup () from /usr/local/lib/php-7.4/libphp7.so
#6 0x000008f293275853 in php_apache2_startup () from /usr/local/lib/php-7.4/libphp7.so
#7 0x000008f2932750e7 in php_apache_server_startup () from /usr/local/lib/php-7.4/libphp7.so
#8 0x000008f02f5b4955 in ap_run_post_config () from /usr/local/sbin/httpd2
#9 0x000008f02f5b36a5 in main () from /usr/local/sbin/httpd2
(gdb)

@unix-world
Copy link
Author

(gdb) bt full
#0 0x000008f23da53eb0 in ?? ()
No symbol table info available.
#1 0x000008f2ef2029e7 in accel_startup () from /usr/local/lib/php-7.4/modules/opcache.so
No symbol table info available.
#2 0x000008f2931d9126 in zend_extension_startup () from /usr/local/lib/php-7.4/libphp7.so
No symbol table info available.
#3 0x000008f2931bbf59 in zend_llist_apply_with_del () from /usr/local/lib/php-7.4/libphp7.so
No symbol table info available.
#4 0x000008f2931d90e5 in zend_startup_extensions () from /usr/local/lib/php-7.4/libphp7.so
No symbol table info available.
#5 0x000008f29315039e in php_module_startup () from /usr/local/lib/php-7.4/libphp7.so
No symbol table info available.
#6 0x000008f293275853 in php_apache2_startup () from /usr/local/lib/php-7.4/libphp7.so
No symbol table info available.
#7 0x000008f2932750e7 in php_apache_server_startup () from /usr/local/lib/php-7.4/libphp7.so
No symbol table info available.
#8 0x000008f02f5b4955 in ap_run_post_config () from /usr/local/sbin/httpd2
No symbol table info available.
#9 0x000008f02f5b36a5 in main () from /usr/local/sbin/httpd2
No symbol table info available.

@unix-world
Copy link
Author

unix-world commented Mar 4, 2022

Even if i use just this in opcache.ini
zend_extension=opcache.so

or if I use:
zend_extension=opcache.so
opcache.enable = 1
opcache.enable_cli = 0
opcache.memory_consumption = 512
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 5000
opcache.max_wasted_percentage = 5
opcache.use_cwd = 1
opcache.validate_timestamps = 1
opcache.revalidate_freq = 2
opcache.revalidate_path = 0
opcache.save_comments = 0
opcache.load_comments = 0
opcache.fast_shutdown = 0
opcache.enable_file_override = 0
;opcache.optimization_level = 0x00000000
opcache.inherited_hack = 1
opcache.blacklist_filename = ""
opcache.max_file_size = 0
opcache.consistency_checks = 0
opcache.force_restart_timeout = 180
opcache.error_log = "/var/log/apache2/php-opcache-errors.log"
opcache.log_verbosity_level = 1
opcache.preferred_memory_model = ""
opcache.protect_memory = 0

It crashes with any of these configs (default or custom) for opcache.ini ...
This opcache.ini I am using since many years and worked OK.
I recently turned on PHP 7.4 and I noticed this crash.
Since I am able to still test this crash also with PHP 7.3 it does not crashes but only crashes with 7.4 / 8.0 / 8.1 if opcache.so is loaded :-(

@unix-world
Copy link
Author

Core

PHP Version 7.4.27

Core
PHP Version 7.4.27
Directive Local Value Master Value
allow_url_fopen Off Off
allow_url_include Off Off
arg_separator.input & &
arg_separator.output & &
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file no value no value
browscap no value no value
default_charset UTF-8 UTF-8
default_mimetype text/html text/html
disable_classes no value no value
disable_functions no value no value
display_errors Off Off
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl Off Off
enable_post_data_reading On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 22527 22527
expose_php On On
extension_dir /usr/local/lib/php-7.4/modules /usr/local/lib/php-7.4/modules
file_uploads On On
hard_timeout 2 2
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #7700 #7700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/pear/lib:/var/www/pear/lib .:/pear/lib:/var/www/pear/lib
input_encoding no value no value
internal_encoding no value no value
log_errors On On
log_errors_max_len 1024 1024
mail.add_x_header Off Off
mail.force_extra_parameters no value no value
mail.log no value no value
max_execution_time 30 30
max_file_uploads 20 20
max_input_nesting_level 64 64
max_input_time 60 60
max_input_vars 1000 1000
memory_limit 256M 256M
open_basedir no value no value
output_buffering 4096 4096
output_encoding no value no value
output_handler no value no value
post_max_size 178M 178M
precision 14 14
realpath_cache_size 4096K 4096K
realpath_cache_ttl 120 120
register_argc_argv Off Off
report_memleaks On On
report_zend_debug On On
request_order GP GP
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision -1 -1
short_open_tag Off Off
SMTP localhost localhost
smtp_port 25 25
sys_temp_dir no value no value
syslog.facility LOG_USER LOG_USER
syslog.filter no-ctrl no-ctrl
syslog.ident php php
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 172M 172M
upload_tmp_dir no value no value
user_dir no value no value
user_ini.cache_ttl 300 300
user_ini.filename .user.ini .user.ini
variables_order GPCS GPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
zend.assertions -1 -1
zend.detect_unicode On On
zend.enable_gc On On
zend.exception_ignore_args On On
zend.multibyte Off Off
zend.script_encoding no value no value
zend.signal_check Off Off

@unix-world
Copy link
Author

pcre

PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 10.35 2020-05-09
PCRE Unicode Version 13.0.0
PCRE JIT Support not compiled in

pcre
PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 10.35 2020-05-09
PCRE Unicode Version 13.0.0
PCRE JIT Support not compiled in

@unix-world
Copy link
Author

Zend OPcache

Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model mmap
Cache hits 0
Cache misses 1
Used memory 17160440
Free memory 519710472
Wasted memory 0
Interned Strings Used memory 387632
Interned Strings Free memory 12194832
Cached scripts 1
Cached keys 2
Max keys 7963
OOM restarts 0
Hash keys restarts 0
Manual restarts 0

Zend OPcache
Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model mmap
Cache hits 0
Cache misses 1
Used memory 17160440
Free memory 519710472
Wasted memory 0
Interned Strings Used memory 387632
Interned Strings Free memory 12194832
Cached scripts 1
Cached keys 2
Max keys 7963
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
Directive Local Value Master Value
opcache.blacklist_filename no value no value
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli Off Off
opcache.enable_file_override Off Off
opcache.error_log /var/log/apache2/php-opcache-errors.log /var/log/apache2/php-opcache-errors.log
opcache.file_cache no value no value
opcache.file_cache_consistency_checks On On
opcache.file_cache_only Off Off
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.huge_code_pages Off Off
opcache.interned_strings_buffer 16 16
opcache.lockfile_path /tmp /tmp
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 5000 5000
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 512 512
opcache.opt_debug_level 0 0
opcache.optimization_level 0x7FFEBFFF 0x7FFEBFFF
opcache.preferred_memory_model no value no value
opcache.preload no value no value
opcache.preload_user no value no value
opcache.protect_memory Off Off
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments Off Off
opcache.use_cwd On On
opcache.validate_permission Off Off
opcache.validate_root Off Off
opcache.validate_timestamps On On

@unix-world
Copy link
Author

The only difference I see between
rcctl restart apache2 (not crashing)
and
kill -HUP 12345 (crashing)
is in errors.log as:

restarting via rcctl says in log: caught SIGWINCH, shutting down gracefully
(ok, not crashing)

but with kill -HUP says in log:
SIGHUP received. Attempting to restart
(in this situation is crashing all the time ...)

@devnexen
Copy link
Member

devnexen commented Mar 4, 2022

(gdb) bt full #0 0x000008f23da53eb0 in ?? () No symbol table info available. #1 0x000008f2ef2029e7 in accel_startup () from /usr/local/lib/php-7.4/modules/opcache.so No symbol table info available. #2 0x000008f2931d9126 in zend_extension_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #3 0x000008f2931bbf59 in zend_llist_apply_with_del () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #4 0x000008f2931d90e5 in zend_startup_extensions () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #5 0x000008f29315039e in php_module_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #6 0x000008f293275853 in php_apache2_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #7 0x000008f2932750e7 in php_apache_server_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #8 0x000008f02f5b4955 in ap_run_post_config () from /usr/local/sbin/httpd2 No symbol table info available. #9 0x000008f02f5b36a5 in main () from /usr/local/sbin/httpd2 No symbol table info available.

thanks however would be best to focus on PHP 8.x, as said in another ticket PHP 7.4 is no longer supported.

@devnexen
Copy link
Member

devnexen commented Mar 4, 2022

There is no php.core, only httpd2.core. I tried looking but there are not enough debug symbols within ... perhaps need a binary package with DEBUG=on ...

That would be ideal if that is possible.

@unix-world
Copy link
Author

(gdb) bt full #0 0x000008f23da53eb0 in ?? () No symbol table info available. #1 0x000008f2ef2029e7 in accel_startup () from /usr/local/lib/php-7.4/modules/opcache.so No symbol table info available. #2 0x000008f2931d9126 in zend_extension_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #3 0x000008f2931bbf59 in zend_llist_apply_with_del () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #4 0x000008f2931d90e5 in zend_startup_extensions () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #5 0x000008f29315039e in php_module_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #6 0x000008f293275853 in php_apache2_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #7 0x000008f2932750e7 in php_apache_server_startup () from /usr/local/lib/php-7.4/libphp7.so No symbol table info available. #8 0x000008f02f5b4955 in ap_run_post_config () from /usr/local/sbin/httpd2 No symbol table info available. #9 0x000008f02f5b36a5 in main () from /usr/local/sbin/httpd2 No symbol table info available.

thanks however would be best to focus on PHP 8.x, as said in another ticket PHP 7.4 is no longer supported.

PHP 8.0 and PHP 8.1 are also crashing on OpenBSD 7.0 amd64 with Apache 2.4.52 !

@unix-world
Copy link
Author

PHP 8.0 GDB

$ gdb /usr/local/sbin/httpd2 /httpd2.core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd7.0"...(no debugging symbols found)

Core was generated by `httpd2'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libpthread.so.26.1...done.
Loaded symbols for /usr/lib/libpthread.so.26.1
Loaded symbols for /usr/local/sbin/httpd2
Reading symbols from /usr/local/lib/libpcre.so.3.0...done.
Loaded symbols for /usr/local/lib/libpcre.so.3.0
Reading symbols from /usr/local/lib/libaprutil-1.so.6.1...done.
Loaded symbols for /usr/local/lib/libaprutil-1.so.6.1
Symbols already loaded for /usr/lib/libpthread.so.26.1
Reading symbols from /usr/lib/libexpat.so.14.0...done.
Loaded symbols for /usr/lib/libexpat.so.14.0
Reading symbols from /usr/local/lib/libiconv.so.7.0...done.
Loaded symbols for /usr/local/lib/libiconv.so.7.0
Reading symbols from /usr/local/lib/libapr-1.so.7.0...done.
Loaded symbols for /usr/local/lib/libapr-1.so.7.0
Reading symbols from /usr/local/lib/libdb.so.5.0...done.
Loaded symbols for /usr/local/lib/libdb.so.5.0
Reading symbols from /usr/lib/libc.so.96.1...done.
Loaded symbols for /usr/lib/libc.so.96.1
Reading symbols from /usr/libexec/ld.so...Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/libexec/ld.so]
Reading symbols from /usr/local/lib/php-8.0/modules/opcache.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/opcache.so
Reading symbols from /usr/local/lib/apache2/mod_authn_file.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authn_file.so
Reading symbols from /usr/local/lib/apache2/mod_authn_core.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authn_core.so
Reading symbols from /usr/local/lib/apache2/mod_authz_host.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_host.so
Reading symbols from /usr/local/lib/apache2/mod_authz_user.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_user.so
Reading symbols from /usr/local/lib/apache2/mod_authz_core.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_core.so
Reading symbols from /usr/local/lib/apache2/mod_access_compat.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_access_compat.so
Reading symbols from /usr/local/lib/apache2/mod_auth_basic.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_auth_basic.so
Reading symbols from /usr/local/lib/apache2/mod_auth_digest.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_auth_digest.so
Reading symbols from /usr/local/lib/apache2/mod_allowmethods.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_allowmethods.so
Reading symbols from /usr/local/lib/apache2/mod_file_cache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_file_cache.so
Reading symbols from /usr/local/lib/apache2/mod_cache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache.so
Reading symbols from /usr/local/lib/apache2/mod_cache_disk.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache_disk.so
Reading symbols from /usr/local/lib/apache2/mod_cache_socache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache_socache.so
Reading symbols from /usr/local/lib/apache2/mod_socache_shmcb.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_socache_shmcb.so
Reading symbols from /usr/local/lib/apache2/mod_socache_memcache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_socache_memcache.so
Reading symbols from /usr/local/lib/apache2/mod_buffer.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_buffer.so
Reading symbols from /usr/local/lib/apache2/mod_reqtimeout.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_reqtimeout.so
Reading symbols from /usr/local/lib/apache2/mod_request.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_request.so
Reading symbols from /usr/local/lib/apache2/mod_include.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_include.so
Reading symbols from /usr/local/lib/apache2/mod_filter.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_filter.so
Reading symbols from /usr/local/lib/apache2/mod_deflate.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_deflate.so
Reading symbols from /usr/lib/libz.so.6.0...done.
Loaded symbols for /usr/lib/libz.so.6.0
Reading symbols from /usr/local/lib/apache2/mod_mime.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mime.so
Reading symbols from /usr/local/lib/apache2/mod_log_config.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_log_config.so
Reading symbols from /usr/local/lib/apache2/mod_env.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_env.so
Reading symbols from /usr/local/lib/apache2/mod_mime_magic.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mime_magic.so
Reading symbols from /usr/local/lib/apache2/mod_expires.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_expires.so
Reading symbols from /usr/local/lib/apache2/mod_headers.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_headers.so
Reading symbols from /usr/local/lib/apache2/mod_unique_id.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_unique_id.so
Reading symbols from /usr/local/lib/apache2/mod_setenvif.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_setenvif.so
Reading symbols from /usr/local/lib/apache2/mod_version.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_version.so
Reading symbols from /usr/local/lib/apache2/mod_session.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_session.so
Reading symbols from /usr/local/lib/apache2/mod_ssl.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_ssl.so
Reading symbols from /usr/lib/libssl.so.50.0...done.
Loaded symbols for /usr/lib/libssl.so.50.0
Reading symbols from /usr/lib/libcrypto.so.47.0...done.
Loaded symbols for /usr/lib/libcrypto.so.47.0
Reading symbols from /usr/local/lib/apache2/mod_mpm_prefork.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mpm_prefork.so
Reading symbols from /usr/local/lib/apache2/mod_unixd.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_unixd.so
Reading symbols from /usr/local/lib/apache2/mod_dav.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav.so
Reading symbols from /usr/local/lib/apache2/mod_status.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_status.so
Reading symbols from /usr/local/lib/apache2/mod_autoindex.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_autoindex.so
Reading symbols from /usr/local/lib/apache2/mod_dav_fs.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_fs.so
Reading symbols from /usr/local/lib/apache2/mod_dav_lock.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_lock.so
Reading symbols from /usr/local/lib/apache2/mod_vhost_alias.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_vhost_alias.so
Reading symbols from /usr/local/lib/apache2/mod_negotiation.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_negotiation.so
Reading symbols from /usr/local/lib/apache2/mod_dir.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dir.so
Reading symbols from /usr/local/lib/apache2/mod_alias.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_alias.so
Reading symbols from /usr/local/lib/apache2/mod_rewrite.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_rewrite.so
Reading symbols from /usr/local/lib/php-8.0/libphp.so...done.
Loaded symbols for /usr/local/lib/php-8.0/libphp.so
Reading symbols from /usr/local/lib/libargon2.so.0.0...done.
Loaded symbols for /usr/local/lib/libargon2.so.0.0
Reading symbols from /usr/lib/libreadline.so.4.0...done.
Loaded symbols for /usr/lib/libreadline.so.4.0
Reading symbols from /usr/lib/libcurses.so.14.0...done.
Loaded symbols for /usr/lib/libcurses.so.14.0
Reading symbols from /usr/local/lib/libintl.so.7.0...done.
Loaded symbols for /usr/local/lib/libintl.so.7.0
Reading symbols from /usr/lib/libutil.so.15.1...done.
Loaded symbols for /usr/lib/libutil.so.15.1
Reading symbols from /usr/lib/libm.so.10.1...done.
Loaded symbols for /usr/lib/libm.so.10.1
Reading symbols from /usr/local/lib/libonig.so.7.2...done.
Loaded symbols for /usr/local/lib/libonig.so.7.2
Reading symbols from /usr/local/lib/libsqlite3.so.37.15...done.
Loaded symbols for /usr/local/lib/libsqlite3.so.37.15
Reading symbols from /usr/local/lib/libxml2.so.17.0...done.
Loaded symbols for /usr/local/lib/libxml2.so.17.0
Reading symbols from /usr/local/lib/liblzma.so.2.1...done.
Loaded symbols for /usr/local/lib/liblzma.so.2.1
Reading symbols from /usr/local/lib/apache2/mod_dav_svn.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_svn.so
Reading symbols from /usr/local/lib/libsvn_repos-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_repos-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_util-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_util-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_subr-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_subr-1.so.6.0
Reading symbols from /usr/local/lib/liblz4.so.3.1...done.
Loaded symbols for /usr/local/lib/liblz4.so.3.1
Reading symbols from /usr/local/lib/libsvn_delta-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_delta-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_fs-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_fs-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_x-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_x-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_base-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_base-1.so.6.0
Reading symbols from /usr/local/lib/apache2/mod_authz_svn.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_svn.so
Reading symbols from /usr/local/lib/php-8.0/modules/bz2.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/bz2.so
Reading symbols from /usr/local/lib/libbz2.so.10.4...done.
Loaded symbols for /usr/local/lib/libbz2.so.10.4
Reading symbols from /usr/local/lib/php-8.0/modules/curl.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/curl.so
Reading symbols from /usr/local/lib/libcurl.so.26.13...done.
Loaded symbols for /usr/local/lib/libcurl.so.26.13
Reading symbols from /usr/local/lib/libnghttp2.so.0.18...done.
Loaded symbols for /usr/local/lib/libnghttp2.so.0.18
Reading symbols from /usr/local/lib/php-8.0/modules/dba.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/dba.so
Reading symbols from /usr/local/lib/libgdbm.so.7.0...done.
Loaded symbols for /usr/local/lib/libgdbm.so.7.0
Reading symbols from /usr/local/lib/php-8.0/modules/gd.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/gd.so
Reading symbols from /usr/local/lib/libgd.so.22.2...done.
Loaded symbols for /usr/local/lib/libgd.so.22.2
Reading symbols from /usr/X11R6/lib/libfreetype.so.30.0...done.
Loaded symbols for /usr/X11R6/lib/libfreetype.so.30.0
Reading symbols from /usr/local/lib/libpng.so.18.0...done.
Loaded symbols for /usr/local/lib/libpng.so.18.0
Reading symbols from /usr/local/lib/libjpeg.so.70.0...done.
Loaded symbols for /usr/local/lib/libjpeg.so.70.0
Reading symbols from /usr/local/lib/libtiff.so.41.0...done.
Loaded symbols for /usr/local/lib/libtiff.so.41.0
Reading symbols from /usr/X11R6/lib/libfontconfig.so.13.0...done.
Loaded symbols for /usr/X11R6/lib/libfontconfig.so.13.0
Reading symbols from /usr/local/lib/libwebp.so.4.3...done.
Loaded symbols for /usr/local/lib/libwebp.so.4.3
Reading symbols from /usr/lib/libc++.so.8.0...done.
Loaded symbols for /usr/lib/libc++.so.8.0
Reading symbols from /usr/lib/libc++abi.so.5.0...done.
Loaded symbols for /usr/lib/libc++abi.so.5.0
Reading symbols from /usr/local/lib/libzstd.so.6.1...done.
Loaded symbols for /usr/local/lib/libzstd.so.6.1
Reading symbols from /usr/local/lib/php-8.0/modules/gmp.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/gmp.so
Reading symbols from /usr/local/lib/libgmp.so.11.0...done.
Loaded symbols for /usr/local/lib/libgmp.so.11.0
Reading symbols from /usr/local/lib/php-8.0/modules/intl.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/intl.so
Reading symbols from /usr/local/lib/libicuio.so.20.0...done.
Loaded symbols for /usr/local/lib/libicuio.so.20.0
Reading symbols from /usr/local/lib/libicui18n.so.20.0...done.
Loaded symbols for /usr/local/lib/libicui18n.so.20.0
Reading symbols from /usr/local/lib/libicuuc.so.20.0...done.
Loaded symbols for /usr/local/lib/libicuuc.so.20.0
Reading symbols from /usr/local/lib/libicudata.so.20.0...done.
Loaded symbols for /usr/local/lib/libicudata.so.20.0
Reading symbols from /usr/local/lib/php-8.0/modules/mongodb.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/mongodb.so
Reading symbols from /usr/lib/libtls.so.22.0...done.
Loaded symbols for /usr/lib/libtls.so.22.0
Reading symbols from /usr/local/lib/php-8.0/modules/mysqli.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/mysqli.so
Reading symbols from /usr/local/lib/php-8.0/modules/pdo_mysql.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/pdo_mysql.so
Reading symbols from /usr/local/lib/php-8.0/modules/pdo_pgsql.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/pdo_pgsql.so
Reading symbols from /usr/local/lib/libpq.so.6.10...done.
Loaded symbols for /usr/local/lib/libpq.so.6.10
Reading symbols from /usr/local/lib/php-8.0/modules/pgsql.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/pgsql.so
Reading symbols from /usr/local/lib/php-8.0/modules/scrypt.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/scrypt.so
Reading symbols from /usr/local/lib/php-8.0/modules/zip.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/zip.so
Reading symbols from /usr/local/lib/libzip.so.4.1...done.
Loaded symbols for /usr/local/lib/libzip.so.4.1
#0 0x00000ef4ef0358a0 in ?? ()

@unix-world
Copy link
Author

unix-world commented Mar 4, 2022

This is the GDB output for PHP 8.0.15

(gdb) list
1 /usr/src/lib/libtls/tls.c: No such file or directory.
in /usr/src/lib/libtls/tls.c
(gdb) bt
#0 0x00000ef4ef0358a0 in ?? ()
#1 0x00000ef429536606 in accel_startup () from /usr/local/lib/php-8.0/modules/opcache.so
#2 0x00000ef44aa42976 in zend_extension_startup () from /usr/local/lib/php-8.0/libphp.so
#3 0x00000ef44aa25889 in zend_llist_apply_with_del () from /usr/local/lib/php-8.0/libphp.so
#4 0x00000ef44a9bb45e in php_module_startup () from /usr/local/lib/php-8.0/libphp.so
#5 0x00000ef44aae7b43 in php_apache2_startup () from /usr/local/lib/php-8.0/libphp.so
#6 0x00000ef44aae73d7 in php_apache_server_startup () from /usr/local/lib/php-8.0/libphp.so
#7 0x00000ef1faf93955 in ap_run_post_config () from /usr/local/sbin/httpd2
#8 0x00000ef1faf926a5 in main () from /usr/local/sbin/httpd2
(gdb) bt full
#0 0x00000ef4ef0358a0 in ?? ()
No symbol table info available.
#1 0x00000ef429536606 in accel_startup () from /usr/local/lib/php-8.0/modules/opcache.so
No symbol table info available.
#2 0x00000ef44aa42976 in zend_extension_startup () from /usr/local/lib/php-8.0/libphp.so
No symbol table info available.
#3 0x00000ef44aa25889 in zend_llist_apply_with_del () from /usr/local/lib/php-8.0/libphp.so
No symbol table info available.
#4 0x00000ef44a9bb45e in php_module_startup () from /usr/local/lib/php-8.0/libphp.so
No symbol table info available.
#5 0x00000ef44aae7b43 in php_apache2_startup () from /usr/local/lib/php-8.0/libphp.so
No symbol table info available.
#6 0x00000ef44aae73d7 in php_apache_server_startup () from /usr/local/lib/php-8.0/libphp.so
No symbol table info available.
#7 0x00000ef1faf93955 in ap_run_post_config () from /usr/local/sbin/httpd2
No symbol table info available.
#8 0x00000ef1faf926a5 in main () from /usr/local/sbin/httpd2
No symbol table info available.

@unix-world
Copy link
Author

PHP Version 8.0.15

PHP Version 8.0.15
System OpenBSD uxm-server.uxm 7.0 GENERIC.MP#5 amd64
Build Date Feb 17 2022 09:58:07
Build System OpenBSD openbsd70.my.domain 7.0 GENERIC.MP#5 amd64
Configure Command './configure' '--with-pcre-jit=no' '--without-valgrind' '--with-zip=shared' '--enable-gd=shared' '--with-jpeg=/usr/local' '--with-png=/usr/local' '--with-webp=/usr/local' '--with-freetype=/usr/X11R6' '--enable-shared' '--disable-static' '--disable-rpath' '--with-config-file-path=/etc' '--enable-inline-optimization' '--with-pic' '--with-pear=/usr/local/share/php-8.0' '--with-config-file-scan-dir=/etc/php-8.0' '--with-pdo-sqlite' '--with-sqlite3' '--with-password-argon2' '--program-suffix=-8.0' '--with-readline' '--with-apxs2=/usr/local/sbin/apxs2' '--with-openssl' '--with-zlib' '--enable-xml' '--enable-wddx' '--enable-cli' '--with-iconv=/usr/local' '--with-gettext=/usr/local' '--enable-bcmath' '--enable-session' '--enable-calendar' '--enable-ctype' '--enable-ftp' '--with-pcre-regex' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-mbstring' '--enable-exif' '--enable-cgi' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-bz2=shared,/usr/local' '--with-curl=shared,/usr/local' '--enable-dba=shared' '--with-gdbm=/usr/local' '--with-external-gd' '--with-gd=shared' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-webp-dir=/usr/local' '--with-zlib-dir=/usr' '--with-t1lib=/usr/local' '--with-freetype-dir=/usr/X11R6' '--with-xpm-dir=/usr/X11R6' '--with-gmp=shared,/usr/local' '--enable-intl=shared' '--with-icu-dir=/usr/local' '--with-imap=shared,/usr/local' '--with-imap-ssl' '--with-ldap=shared,/usr/local' '--with-mysqli=shared' '--disable-iodbc' '--enable-pcntl=shared' '--with-pdo-mysql=shared' '--with-pdo-pgsql=shared,/usr/local' '--with-pgsql=shared,/usr/local' '--with-pspell=shared,/usr/local' '--enable-shmop=shared,/usr/local' '--enable-soap=shared,/usr/local' '--with-snmp=shared,/usr/local' '--with-tidy=shared,/usr/local' '--with-xsl=shared' '--enable-dom' '--enable-zip=shared,/usr/local' '--prefix=/usr/local' '--sysconfdir=/etc' '--mandir=/usr/local/man' '--infodir=/usr/local/info' '--localstatedir=/var' '--disable-silent-rules' '--disable-gtk-doc' 'CFLAGS=-O2 -pipe -I/usr/local/include -pthread'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc
Loaded Configuration File /etc/php-8.0.ini
Scan this dir for additional .ini files /etc/php-8.0
Additional .ini files parsed /etc/php-8.0/bz2.ini, /etc/php-8.0/curl.ini, /etc/php-8.0/dba.ini, /etc/php-8.0/gd.ini, /etc/php-8.0/gmp.ini, /etc/php-8.0/intl.ini, /etc/php-8.0/mongodb.ini, /etc/php-8.0/mysqli.ini, /etc/php-8.0/opcache.ini, /etc/php-8.0/pdo_mysql.ini, /etc/php-8.0/pdo_pgsql.ini, /etc/php-8.0/pgsql.ini, /etc/php-8.0/scrypt.ini, /etc/php-8.0/zip.ini
PHP API 20200930
PHP Extension 20200930
Zend Extension 420200930
Zend Extension Build API420200930,NTS
PHP Extension Build API20200930,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters zlib., convert.iconv., bzip2., string.rot13, string.toupper, string.tolower, convert., consumed, dechunk
Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.0.15, Copyright (c) Zend Technologies
with Zend OPcache v8.0.15, Copyright (c), by Zend Technologies

@unix-world
Copy link
Author

unix-world commented Mar 4, 2022

PHP 8.0.15

Zend OPcache

Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
JIT Disabled
Startup OK
Shared memory model mmap
Cache hits 0
Cache misses 1
Used memory 9168624
Free memory 125049104
Wasted memory 0
Interned Strings Used memory 394656
Interned Strings Free memory 5896336
Cached scripts 1
Cached keys 2
Max keys 16229
OOM restarts 0
Hash keys restarts 0
Manual restarts 0

Zend OPcache
Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
JIT Disabled
Startup OK
Shared memory model mmap
Cache hits 0
Cache misses 1
Used memory 9168624
Free memory 125049104
Wasted memory 0
Interned Strings Used memory 394656
Interned Strings Free memory 5896336
Cached scripts 1
Cached keys 2
Max keys 16229
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
Directive Local Value Master Value
opcache.blacklist_filename no value no value
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli Off Off
opcache.enable_file_override Off Off
opcache.error_log no value no value
opcache.file_cache no value no value
opcache.file_cache_consistency_checks On On
opcache.file_cache_only Off Off
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.huge_code_pages Off Off
opcache.interned_strings_buffer 8 8
opcache.jit tracing tracing
opcache.jit_bisect_limit 0 0
opcache.jit_blacklist_root_trace 16 16
opcache.jit_blacklist_side_trace 8 8
opcache.jit_buffer_size 0 0
opcache.jit_debug 0 0
opcache.jit_hot_func 127 127
opcache.jit_hot_loop 64 64
opcache.jit_hot_return 8 8
opcache.jit_hot_side_exit 8 8
opcache.jit_max_exit_counters 8192 8192
opcache.jit_max_loop_unrolls 8 8
opcache.jit_max_polymorphic_calls 2 2
opcache.jit_max_recursive_calls 2 2
opcache.jit_max_recursive_returns 2 2
opcache.jit_max_root_traces 1024 1024
opcache.jit_max_side_traces 128 128
opcache.jit_prof_threshold 0.005 0.005
opcache.lockfile_path /tmp /tmp
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 10000 10000
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 128 128
opcache.opt_debug_level 0 0
opcache.optimization_level 0x7FFEBFFF 0x7FFEBFFF
opcache.preferred_memory_model no value no value
opcache.preload no value no value
opcache.preload_user no value no value
opcache.protect_memory Off Off
opcache.record_warnings Off Off
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments On On
opcache.use_cwd On On
opcache.validate_permission Off Off
opcache.validate_root Off Off
opcache.validate_timestamps On On

@unix-world
Copy link
Author

unix-world commented Mar 4, 2022

Just to answer for the fact you wrote that PHP 7.4 is no more supported ...

I repeat any of: PHP 8.1.2 / PHP 8.0.15 / PHP 7.4.27 are affected by this issue I reported.

Looks like the only unaffected version is PHP 7.3.33 !

I have all 4 versions installed on OpenBSD 7.0, I can switch and use any of these versions.
Thus, PHP 7.4.27 is Crashing, PHP 8.0.15 is Crashing, PHP 8.1.2 is Crashing when doing: kill -HUP 12345 (where 12345 is the PID of Apache 2.4.52), apache MPM Prefork.

If I disable in opcache.ini the opcache.so no crash happen in any of these versions !

Thus this makes me think this is something related with the opcache module of PHP.

If I do
rcctl restart apache2
is not crashing because the event here is SIGWINCH
"[mpm_prefork:notice] [pid 31450] AH00170: caught SIGWINCH, shutting down gracefully"

When the apache logs are rotating, as usual it must be:
kill -HUP 12345 (where the 12345 is the current Apache2 PID)

I am using OpenBSD since 10 years or so. Log rotation using kill -HUP 12345 did never crashed Apache MPM Prefork with PHP until now. And also now just PHP 7.4 / 8.0 / 8.1 are affected and PHP 7.3 is unaffected.
I recently switched from PHP 7.3.33 to 7.4.27 and I noticed this crash.
I was tought that this issue is perhaps just in PHP 7.4.x thus I installed also PHP 8.0.15 and PHP 8.1.2 to test if works. Except PHP 7.3.33 (which does not crash on SIGHUP), the PHP 7.4.27, PHP 8.0.15 and PHP 8.1.2 are all crashing with SIGHUP !

I will install over the weekend PHP 7.4.28 / 8.0.16 and 8.1.3 and test again but I am sure they will also be crashing because I had not seen any fix regarding the opcache area in the changes between.

This is not an OpenBSD 7.0 or Apache 2.4.52 issue ... PHP 7.3.33 is not crashing under the exact conditions, configurations, OS version and Apache version ...
Thus if you would no more consider PHP 7.4 ... OK, but please consider PHP 8.0.x and 8.1.x are crashing on SIGHUP under OpenBSD 7.0 amd64 / Apache 2.4.52.

Perhaps you are confused how different PHP versions can coexist ... under OpenBSD the official packages can coexist all installed and can activate any of them. So this is how I am able to test any PHP version by just switching the Apache PHP module on-the-fly keeping the same configs...
https://openports.se/lang/php

@unix-world
Copy link
Author

Question: which version of PHP would you like me to compile with DEBUG on ? 8.0.16 or 8.1.3 ?
I am planning to do this over the weekend ...

@devnexen
Copy link
Member

devnexen commented Mar 4, 2022

since it s most likely a bug fix to consider, PHP 8.0 seems the way to go, at least for starter. we ll see if this is duplicated existing bug or not.

@unix-world unix-world changed the title Apache / PHP segfaults Apache / PHP segfaults (PHP 8.0 and 8.1, but also 7.4) Mar 4, 2022
@unix-world
Copy link
Author

OK.

@unix-world
Copy link
Author

unix-world commented Mar 4, 2022

PHP 8.0.15 DBG (built with --enable-debug=yes)

I hope this helps

PHP Version 8.0.15

PHP Version 8.0.15
System OpenBSD uxm-server.uxm 7.0 GENERIC.MP#5 amd64
Build Date Mar 4 2022 23:14:16
Build System OpenBSD obsd70.my.domain 7.0 GENERIC#5 amd64
Configure Command './configure' '--with-pcre-jit=no' '--without-valgrind' '--enable-debug=yes' '--with-zip=shared' '--enable-gd=shared' '--with-jpeg=/usr/local' '--with-png=/usr/local' '--with-webp=/usr/local' '--with-freetype=/usr/X11R6' '--enable-shared' '--disable-static' '--disable-rpath' '--with-config-file-path=/etc' '--enable-inline-optimization' '--with-pic' '--with-pear=/usr/local/share/php-8.0' '--with-config-file-scan-dir=/etc/php-8.0' '--with-pdo-sqlite' '--with-sqlite3' '--with-password-argon2' '--program-suffix=-8.0' '--with-readline' '--with-apxs2=/usr/local/sbin/apxs2' '--with-openssl' '--with-zlib' '--enable-xml' '--enable-wddx' '--enable-cli' '--with-iconv=/usr/local' '--with-gettext=/usr/local' '--enable-bcmath' '--enable-session' '--enable-calendar' '--enable-ctype' '--enable-ftp' '--with-pcre-regex' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-mbstring' '--enable-exif' '--enable-cgi' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-bz2=shared,/usr/local' '--with-curl=shared,/usr/local' '--enable-dba=shared' '--with-gdbm=/usr/local' '--with-external-gd' '--with-gd=shared' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-webp-dir=/usr/local' '--with-zlib-dir=/usr' '--with-t1lib=/usr/local' '--with-freetype-dir=/usr/X11R6' '--with-xpm-dir=/usr/X11R6' '--with-gmp=shared,/usr/local' '--enable-intl=shared' '--with-icu-dir=/usr/local' '--with-imap=shared,/usr/local' '--with-imap-ssl' '--with-ldap=shared,/usr/local' '--with-mysqli=shared' '--disable-iodbc' '--enable-pcntl=shared' '--with-pdo-mysql=shared' '--with-pdo-pgsql=shared,/usr/local' '--with-pgsql=shared,/usr/local' '--with-pspell=shared,/usr/local' '--enable-shmop=shared,/usr/local' '--enable-soap=shared,/usr/local' '--with-snmp=shared,/usr/local' '--with-tidy=shared,/usr/local' '--with-xsl=shared' '--enable-dom' '--enable-zip=shared,/usr/local' '--prefix=/usr/local' '--sysconfdir=/etc' '--mandir=/usr/local/man' '--infodir=/usr/local/info' '--localstatedir=/var' '--disable-silent-rules' '--disable-gtk-doc' 'CFLAGS=-O2 -pipe -I/usr/local/include -pthread'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc
Loaded Configuration File /etc/php-8.0.ini
Scan this dir for additional .ini files /etc/php-8.0
Additional .ini files parsed /etc/php-8.0/bz2.ini, /etc/php-8.0/curl.ini, /etc/php-8.0/dba.ini, /etc/php-8.0/gd.ini, /etc/php-8.0/gmp.ini, /etc/php-8.0/intl.ini, /etc/php-8.0/mongodb.ini, /etc/php-8.0/mysqli.ini, /etc/php-8.0/opcache.ini, /etc/php-8.0/pdo_mysql.ini, /etc/php-8.0/pdo_pgsql.ini, /etc/php-8.0/pgsql.ini, /etc/php-8.0/scrypt.ini, /etc/php-8.0/zip.ini
PHP API 20200930
PHP Extension 20200930
Zend Extension 420200930
Zend Extension Build API420200930,NTS,debug
PHP Extension Build API20200930,NTS,debug
Debug Build yes
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters zlib., convert.iconv., bzip2., string.rot13, string.toupper, string.tolower, convert., consumed, dechunk
Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.0.15, Copyright (c) Zend Technologies
with Zend OPcache v8.0.15, Copyright (c), by Zend Technologies

See below the Debug Info

gdb /usr/local/sbin/httpd2 /httpd2.core                                                                                                                                          
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd7.0"...(no debugging symbols found)

Core was generated by `httpd2'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libpthread.so.26.1...done.
Loaded symbols for /usr/lib/libpthread.so.26.1
Loaded symbols for /usr/local/sbin/httpd2
Reading symbols from /usr/local/lib/libpcre.so.3.0...done.
Loaded symbols for /usr/local/lib/libpcre.so.3.0
Reading symbols from /usr/local/lib/libaprutil-1.so.6.1...done.
Loaded symbols for /usr/local/lib/libaprutil-1.so.6.1
Symbols already loaded for /usr/lib/libpthread.so.26.1
Reading symbols from /usr/lib/libexpat.so.14.0...done.
Loaded symbols for /usr/lib/libexpat.so.14.0
Reading symbols from /usr/local/lib/libiconv.so.7.0...done.
Loaded symbols for /usr/local/lib/libiconv.so.7.0
Reading symbols from /usr/local/lib/libapr-1.so.7.0...done.
Loaded symbols for /usr/local/lib/libapr-1.so.7.0
Reading symbols from /usr/local/lib/libdb.so.5.0...done.
Loaded symbols for /usr/local/lib/libdb.so.5.0
Reading symbols from /usr/lib/libc.so.96.1...done.
Loaded symbols for /usr/lib/libc.so.96.1
Reading symbols from /usr/libexec/ld.so...Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/libexec/ld.so]
Reading symbols from /usr/local/lib/php-8.0/modules/opcache.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/opcache.so
Reading symbols from /usr/local/lib/apache2/mod_authn_file.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authn_file.so
Reading symbols from /usr/local/lib/apache2/mod_authn_core.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authn_core.so
Reading symbols from /usr/local/lib/apache2/mod_authz_host.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_host.so
Reading symbols from /usr/local/lib/apache2/mod_authz_user.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_user.so
Reading symbols from /usr/local/lib/apache2/mod_authz_core.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_core.so
Reading symbols from /usr/local/lib/apache2/mod_access_compat.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_access_compat.so
Reading symbols from /usr/local/lib/apache2/mod_auth_basic.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_auth_basic.so
Reading symbols from /usr/local/lib/apache2/mod_auth_digest.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_auth_digest.so
Reading symbols from /usr/local/lib/apache2/mod_allowmethods.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_allowmethods.so
Reading symbols from /usr/local/lib/apache2/mod_file_cache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_file_cache.so
Reading symbols from /usr/local/lib/apache2/mod_cache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache.so
Reading symbols from /usr/local/lib/apache2/mod_cache_disk.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache_disk.so
Reading symbols from /usr/local/lib/apache2/mod_cache_socache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_cache_socache.so
Reading symbols from /usr/local/lib/apache2/mod_socache_shmcb.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_socache_shmcb.so
Reading symbols from /usr/local/lib/apache2/mod_socache_memcache.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_socache_memcache.so
Reading symbols from /usr/local/lib/apache2/mod_buffer.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_buffer.so
Reading symbols from /usr/local/lib/apache2/mod_reqtimeout.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_reqtimeout.so
Reading symbols from /usr/local/lib/apache2/mod_request.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_request.so
Reading symbols from /usr/local/lib/apache2/mod_include.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_include.so
Reading symbols from /usr/local/lib/apache2/mod_filter.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_filter.so
Reading symbols from /usr/local/lib/apache2/mod_deflate.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_deflate.so
Reading symbols from /usr/lib/libz.so.6.0...done.
Loaded symbols for /usr/lib/libz.so.6.0
Reading symbols from /usr/local/lib/apache2/mod_mime.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mime.so
Reading symbols from /usr/local/lib/apache2/mod_log_config.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_log_config.so
Reading symbols from /usr/local/lib/apache2/mod_env.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_env.so
Reading symbols from /usr/local/lib/apache2/mod_mime_magic.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mime_magic.so
Reading symbols from /usr/local/lib/apache2/mod_expires.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_expires.so
Reading symbols from /usr/local/lib/apache2/mod_headers.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_headers.so
Reading symbols from /usr/local/lib/apache2/mod_unique_id.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_unique_id.so
Reading symbols from /usr/local/lib/apache2/mod_setenvif.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_setenvif.so
Reading symbols from /usr/local/lib/apache2/mod_version.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_version.so
Reading symbols from /usr/local/lib/apache2/mod_session.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_session.so
Reading symbols from /usr/local/lib/apache2/mod_ssl.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_ssl.so
Reading symbols from /usr/lib/libssl.so.50.0...done.
Loaded symbols for /usr/lib/libssl.so.50.0
Reading symbols from /usr/lib/libcrypto.so.47.0...done.
Loaded symbols for /usr/lib/libcrypto.so.47.0
Reading symbols from /usr/local/lib/apache2/mod_mpm_prefork.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_mpm_prefork.so
Reading symbols from /usr/local/lib/apache2/mod_unixd.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_unixd.so
Reading symbols from /usr/local/lib/apache2/mod_dav.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav.so
Reading symbols from /usr/local/lib/apache2/mod_status.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_status.so
Reading symbols from /usr/local/lib/apache2/mod_autoindex.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_autoindex.so
Reading symbols from /usr/local/lib/apache2/mod_dav_fs.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_fs.so
Reading symbols from /usr/local/lib/apache2/mod_dav_lock.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_lock.so
Reading symbols from /usr/local/lib/apache2/mod_vhost_alias.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_vhost_alias.so
Reading symbols from /usr/local/lib/apache2/mod_negotiation.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_negotiation.so
Reading symbols from /usr/local/lib/apache2/mod_dir.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dir.so
Reading symbols from /usr/local/lib/apache2/mod_alias.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_alias.so
Reading symbols from /usr/local/lib/apache2/mod_rewrite.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_rewrite.so
Reading symbols from /usr/local/lib/php-8.0/libphp.so...done.
Loaded symbols for /usr/local/lib/php-8.0/libphp.so
Reading symbols from /usr/local/lib/libargon2.so.0.0...done.
Loaded symbols for /usr/local/lib/libargon2.so.0.0
Reading symbols from /usr/lib/libreadline.so.4.0...done.
Loaded symbols for /usr/lib/libreadline.so.4.0
Reading symbols from /usr/lib/libcurses.so.14.0...done.
Loaded symbols for /usr/lib/libcurses.so.14.0
Reading symbols from /usr/local/lib/libintl.so.7.0...done.
Loaded symbols for /usr/local/lib/libintl.so.7.0
Reading symbols from /usr/lib/libutil.so.15.1...done.
Loaded symbols for /usr/lib/libutil.so.15.1
Reading symbols from /usr/lib/libm.so.10.1...done.
Loaded symbols for /usr/lib/libm.so.10.1
Reading symbols from /usr/local/lib/libonig.so.7.2...done.
Loaded symbols for /usr/local/lib/libonig.so.7.2
Reading symbols from /usr/local/lib/libsqlite3.so.37.15...done.
Loaded symbols for /usr/local/lib/libsqlite3.so.37.15
Reading symbols from /usr/local/lib/libxml2.so.17.0...done.
Loaded symbols for /usr/local/lib/libxml2.so.17.0
Reading symbols from /usr/local/lib/liblzma.so.2.1...done.
Loaded symbols for /usr/local/lib/liblzma.so.2.1
Reading symbols from /usr/local/lib/apache2/mod_dav_svn.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_dav_svn.so
Reading symbols from /usr/local/lib/libsvn_repos-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_repos-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_util-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_util-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_subr-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_subr-1.so.6.0
Reading symbols from /usr/local/lib/liblz4.so.3.1...done.
Loaded symbols for /usr/local/lib/liblz4.so.3.1
Reading symbols from /usr/local/lib/libsvn_delta-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_delta-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_fs-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_fs-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_x-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_x-1.so.6.0
Reading symbols from /usr/local/lib/libsvn_fs_base-1.so.6.0...done.
Loaded symbols for /usr/local/lib/libsvn_fs_base-1.so.6.0
Reading symbols from /usr/local/lib/apache2/mod_authz_svn.so...done.
Loaded symbols for /usr/local/lib/apache2/mod_authz_svn.so
Reading symbols from /usr/local/lib/php-8.0/modules/bz2.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/bz2.so
Reading symbols from /usr/local/lib/libbz2.so.10.4...done.
Loaded symbols for /usr/local/lib/libbz2.so.10.4
Reading symbols from /usr/local/lib/php-8.0/modules/curl.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/curl.so
Reading symbols from /usr/local/lib/libcurl.so.26.13...done.
Loaded symbols for /usr/local/lib/libcurl.so.26.13
Reading symbols from /usr/local/lib/libnghttp2.so.0.18...done.
Loaded symbols for /usr/local/lib/libnghttp2.so.0.18
Reading symbols from /usr/local/lib/php-8.0/modules/dba.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/dba.so
Reading symbols from /usr/local/lib/libgdbm.so.7.0...done.
Loaded symbols for /usr/local/lib/libgdbm.so.7.0
Reading symbols from /usr/local/lib/php-8.0/modules/gd.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/gd.so
Reading symbols from /usr/local/lib/libgd.so.22.2...done.
Loaded symbols for /usr/local/lib/libgd.so.22.2
Reading symbols from /usr/X11R6/lib/libfreetype.so.30.0...done.
Loaded symbols for /usr/X11R6/lib/libfreetype.so.30.0
Reading symbols from /usr/local/lib/libpng.so.18.0...done.
Loaded symbols for /usr/local/lib/libpng.so.18.0
Reading symbols from /usr/local/lib/libjpeg.so.70.0...done.
Loaded symbols for /usr/local/lib/libjpeg.so.70.0
Reading symbols from /usr/local/lib/libtiff.so.41.0...done.
Loaded symbols for /usr/local/lib/libtiff.so.41.0
Reading symbols from /usr/X11R6/lib/libfontconfig.so.13.0...done.
Loaded symbols for /usr/X11R6/lib/libfontconfig.so.13.0
Reading symbols from /usr/local/lib/libwebp.so.4.3...done.
Loaded symbols for /usr/local/lib/libwebp.so.4.3
Reading symbols from /usr/lib/libc++.so.8.0...done.
Loaded symbols for /usr/lib/libc++.so.8.0
Reading symbols from /usr/lib/libc++abi.so.5.0...done.
Loaded symbols for /usr/lib/libc++abi.so.5.0
Reading symbols from /usr/local/lib/libzstd.so.6.1...done.
Loaded symbols for /usr/local/lib/libzstd.so.6.1
Reading symbols from /usr/local/lib/php-8.0/modules/gmp.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/gmp.so
Reading symbols from /usr/local/lib/libgmp.so.11.0...done.
Loaded symbols for /usr/local/lib/libgmp.so.11.0
Reading symbols from /usr/local/lib/php-8.0/modules/intl.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/intl.so
Reading symbols from /usr/local/lib/libicuio.so.20.0...done.
Loaded symbols for /usr/local/lib/libicuio.so.20.0
Reading symbols from /usr/local/lib/libicui18n.so.20.0...done.
Loaded symbols for /usr/local/lib/libicui18n.so.20.0
Reading symbols from /usr/local/lib/libicuuc.so.20.0...done.
Loaded symbols for /usr/local/lib/libicuuc.so.20.0
Reading symbols from /usr/local/lib/libicudata.so.20.0...done.
Loaded symbols for /usr/local/lib/libicudata.so.20.0
Reading symbols from /usr/local/lib/php-8.0/modules/mysqli.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/mysqli.so
Reading symbols from /usr/local/lib/php-8.0/modules/pdo_mysql.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/pdo_mysql.so
Reading symbols from /usr/local/lib/php-8.0/modules/pdo_pgsql.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/pdo_pgsql.so
Reading symbols from /usr/local/lib/libpq.so.6.10...done.
Loaded symbols for /usr/local/lib/libpq.so.6.10
Reading symbols from /usr/local/lib/php-8.0/modules/pgsql.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/pgsql.so
Reading symbols from /usr/local/lib/php-8.0/modules/zip.so...done.
Loaded symbols for /usr/local/lib/php-8.0/modules/zip.so
Reading symbols from /usr/local/lib/libzip.so.4.1...done.
Loaded symbols for /usr/local/lib/libzip.so.4.1
#0  0x0000016f89cb7aa0 in ?? ()
(gdb) list
1	ext/zip/php_zip.c: No such file or directory.
	in ext/zip/php_zip.c
(gdb) bt
#0  0x0000016f89cb7aa0 in ?? ()
#1  0x0000016f76872ede in start_accel_module () at ext/opcache/zend_accelerator_module.c:518
#2  0x0000016f7686594f in accel_startup (extension=0x16f4bdd0510) at ext/opcache/ZendAccelerator.c:2901
#3  0x0000016f39047819 in zend_extension_startup (extension=0x16f4bdd0510) at Zend/zend_extensions.c:196
#4  0x0000016f39014754 in zend_llist_apply_with_del (l=0x16f3925d548, func=0x16f390477e0 <zend_extension_startup>) at Zend/zend_llist.c:169
#5  0x0000016f390477c5 in zend_startup_extensions () at Zend/zend_extensions.c:217
#6  0x0000016f38f65003 in php_module_startup (sf=0x16f39243d30, additional_modules=0x16f39243e48, num_additional_modules=1) at main/main.c:2261
#7  0x0000016f3917c90e in php_apache2_startup (sapi_module=0x16f39243d30) at sapi/apache2handler/sapi_apache2.c:376
#8  0x0000016f3917bef5 in php_apache_server_startup (pconf=0x16ef9a6c028, plog=0x16f20dda028, ptemp=0x16f68890028, s=0x16ed7637110) at sapi/apache2handler/sapi_apache2.c:490
#9  0x0000016caf170955 in ap_run_post_config () from /usr/local/sbin/httpd2
#10 0x0000016caf16f6a5 in main () from /usr/local/sbin/httpd2
(gdb) bt full
#0  0x0000016f89cb7aa0 in ?? ()
No symbol table info available.
#1  0x0000016f76872ede in start_accel_module () at ext/opcache/zend_accelerator_module.c:518
No locals.
#2  0x0000016f7686594f in accel_startup (extension=0x16f4bdd0510) at ext/opcache/ZendAccelerator.c:2901
No locals.
#3  0x0000016f39047819 in zend_extension_startup (extension=0x16f4bdd0510) at Zend/zend_extensions.c:196
No locals.
#4  0x0000016f39014754 in zend_llist_apply_with_del (l=0x16f3925d548, func=0x16f390477e0 <zend_extension_startup>) at Zend/zend_llist.c:169
	element = (zend_llist_element *) 0x16f4bdd0500
	next = (zend_llist_element *) 0x0
#5  0x0000016f390477c5 in zend_startup_extensions () at Zend/zend_extensions.c:217
No locals.
#6  0x0000016f38f65003 in php_module_startup (sf=0x16f39243d30, additional_modules=0x16f39243e48, num_additional_modules=1) at main/main.c:2261
	zuf = {error_function = 0x16f38f65360 <php_error_cb>, printf_function = 0x16f38f62300 <php_printf>, write_function = 0x16f38f86cc0 <php_output_write>, 
  fopen_function = 0x16f38f65e80 <php_fopen_wrapper_for_zend>, message_handler = 0x16f38f65f00 <php_message_handler_for_zend>, 
  get_configuration_directive = 0x16f38f66580 <php_get_configuration_directive_for_zend>, ticks_function = 0x16f38f82f90 <php_run_ticks>, on_timeout = 0x16f38f63d80 <php_on_timeout>, 
  stream_open_function = 0x16f38f665c0 <php_stream_open_for_zend>, printf_to_smart_string_function = 0x16f38f6d610 <php_printf_to_smart_string>, 
  printf_to_smart_str_function = 0x16f38f700d0 <php_printf_to_smart_str>, getenv_function = 0x16f38f791d0 <sapi_getenv>, resolve_path_function = 0x16f38f66610 <php_resolve_path_for_zend>}
	zuv = {html_errors = true}
	retval = 0
	module_number = 0
	php_os = 0x16f38156eb0 "OpenBSD"
	module = (zend_module_entry *) 0x20
#7  0x0000016f3917c90e in php_apache2_startup (sapi_module=0x16f39243d30) at sapi/apache2handler/sapi_apache2.c:376
No locals.
#8  0x0000016f3917bef5 in php_apache_server_startup (pconf=0x16ef9a6c028, plog=0x16f20dda028, ptemp=0x16f68890028, s=0x16ed7637110) at sapi/apache2handler/sapi_apache2.c:490
	data = (void *) 0x1
	userdata_key = 0x16f3818a8da "apache2hook_post_config"
#9  0x0000016caf170955 in ap_run_post_config () from /usr/local/sbin/httpd2
No symbol table info available.
#10 0x0000016caf16f6a5 in main () from /usr/local/sbin/httpd2
No symbol table info available.
END

@unix-world
Copy link
Author

unix-world commented Mar 4, 2022

This above (debug) build was using the official OpenBSD 7.0 / PHP 8.0 package (includding specific platform patches), except I added one extra flag: "--enable-debug=yes".
The official OpenBSD 7.0 platform specific patches for PHP 8.0 can be found
here:
https://github.com/openbsd/ports/tree/master/lang/php/8.0/patches
or here:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/php/8.0/patches/?hideattic=1#dirlist

@unix-world
Copy link
Author

unix-world commented Mar 5, 2022

Here is a second debug log that the OpenBSD package maintainer sent me, using a newer GDB version:

PHP 8.0.15 (debug) with newer GDB 9.2

> Reading symbols from /usr/local/lib/php-8.0/modules/zip.so...done.
> Loaded symbols for /usr/local/lib/php-8.0/modules/zip.so
> Reading symbols from /usr/local/lib/libzip.so.4.1...done.
> Loaded symbols for /usr/local/lib/libzip.so.4.1
> #0  0x0000016f89cb7aa0 in ?? ()
> (gdb) list
> 1 ext/zip/php_zip.c: No such file or directory.
> in ext/zip/php_zip.c
> (gdb) bt
> #0  0x0000016f89cb7aa0 in ?? ()
> #1  0x0000016f76872ede in start_accel_module () at ext/opcache/zend_accelerator_module.c:518
> #2  0x0000016f7686594f in accel_startup (extension=0x16f4bdd0510) at ext/opcache/
> ZendAccelerator.c:2901
> #3  0x0000016f39047819 in zend_extension_startup (extension=0x16f4bdd0510) at Zend/
> zend_extensions.c:196
[..]
$ egdb httpd2 /httpd2.core 
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-openbsd7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from httpd2...
Reading symbols from /usr/local/sbin/.debug/httpd2.dbg...
[New process 199520]
Core was generated by `httpd2'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000cebe2b39380 in ?? ()
(gdb) bt
#0  0x00000cebe2b39380 in ?? ()
#1  0x00000cec80fed18e in start_accel_module () at ext/opcache/zend_accelerator_module.c:518
#2  0x00000cec80fdf63f in accel_startup (extension=0xcec16ffe210) at ext/opcache/ZendAccelerator.c:3114
#3  0x00000cebe081fd29 in zend_extension_startup (extension=0xcec16ffe210) at Zend/zend_extensions.c:196
#4  0x00000cebe07d85df in zend_llist_apply_with_del (l=0xcebe0bf37c8 <zend_extensions>,
    func=0xcebe081fcf0 <zend_extension_startup>) at Zend/zend_llist.c:171
#5  0x00000cebe081fcd5 in zend_startup_extensions () at Zend/zend_extensions.c:217
#6  0x00000cebe06fd468 in php_module_startup (sf=0xcebe0bdaba8 <apache2_sapi_module>,
    additional_modules=0xcebe0bdacc0 <php_apache_module>, num_additional_modules=1) at main/main.c:2259
#7  0x00000cebe0b0aa0e in php_apache2_startup (sapi_module=0xcebe0bdaba8 <apache2_sapi_module>)
    at sapi/apache2handler/sapi_apache2.c:376
#8  0x00000cebe0b09fd5 in php_apache_server_startup (pconf=0xcec6f92c028, plog=0xcec23c36028, ptemp=0xcec66ee5028,
    s=0xcec6ecd3110) at sapi/apache2handler/sapi_apache2.c:490
#9  0x00000ce9da79c935 in ap_run_post_config (pconf=0xcec6f92c028, plog=0xcec23c36028, ptemp=0xcec66ee5028, s=0xcec6ecd3110)
    at config.c:102
#10 0x00000ce9da797843 in main (argc=3, argv=0x7f7ffffd4838) at main.c:807
(gdb) bt full
#0  0x00000cebe2b39380 in ?? ()
No symbol table info available.
#1  0x00000cec80fed18e in start_accel_module () at ext/opcache/zend_accelerator_module.c:518
No locals.
#2  0x00000cec80fdf63f in accel_startup (extension=0xcec16ffe210) at ext/opcache/ZendAccelerator.c:3114
No locals.
#3  0x00000cebe081fd29 in zend_extension_startup (extension=0xcec16ffe210) at Zend/zend_extensions.c:196
No locals.
#4  0x00000cebe07d85df in zend_llist_apply_with_del (l=0xcebe0bf37c8 <zend_extensions>,
    func=0xcebe081fcf0 <zend_extension_startup>) at Zend/zend_llist.c:171
        element = 0xcec16ffe200
        next = 0x0
#5  0x00000cebe081fcd5 in zend_startup_extensions () at Zend/zend_extensions.c:217
No locals.
#6  0x00000cebe06fd468 in php_module_startup (sf=0xcebe0bdaba8 <apache2_sapi_module>,
    additional_modules=0xcebe0bdacc0 <php_apache_module>, num_additional_modules=1) at main/main.c:2259
        zuf = {
          error_function = 0xcebe06fd830 <php_error_cb>,
          printf_function = 0xcebe06faa80 <php_printf>,
          write_function = 0xcebe0720570 <php_output_write>,
          fopen_function = 0xcebe06fe610 <php_fopen_wrapper_for_zend>,
          message_handler = 0xcebe06fe670 <php_message_handler_for_zend>,
          get_configuration_directive = 0xcebe06fe9d0 <php_get_configuration_directive_for_zend>,
          ticks_function = 0xcebe071cad0 <php_run_ticks>,
          on_timeout = 0xcebe06fc0e0 <php_on_timeout>,
          stream_open_function = 0xcebe06fea10 <php_stream_open_for_zend>,
          printf_to_smart_string_function = 0xcebe07051f0 <php_printf_to_smart_string>,
          printf_to_smart_str_function = 0xcebe0708920 <php_printf_to_smart_str>,
          getenv_function = 0xcebe07118a0 <sapi_getenv>,
          resolve_path_function = 0xcebe06fea50 <php_resolve_path_for_zend>
        }
        zuv = {
          html_errors = true
        }
        retval = 0
        module_number = 0
        php_os = 0xcebdf8e08ea "OpenBSD"
        module = 0xcebdf901034
#7  0x00000cebe0b0aa0e in php_apache2_startup (sapi_module=0xcebe0bdaba8 <apache2_sapi_module>)
    at sapi/apache2handler/sapi_apache2.c:376
No locals.
#8  0x00000cebe0b09fd5 in php_apache_server_startup (pconf=0xcec6f92c028, plog=0xcec23c36028, ptemp=0xcec66ee5028,
    s=0xcec6ecd3110) at sapi/apache2handler/sapi_apache2.c:490
        data = 0x1
        userdata_key = 0xcebdf90aaf6 "apache2hook_post_config"

#9  0x00000ce9da79c935 in ap_run_post_config (pconf=0xcec6f92c028, plog=0xcec23c36028, ptemp=0xcec66ee5028, s=0xcec6ecd3110)
    at config.c:102
        rv = <error reading variable rv (Cannot access memory at address 0x0)>
        pHook = <optimized out>
        n = 9
#10 0x00000ce9da797843 in main (argc=3, argv=0x7f7ffffd4838) at main.c:807
        rc = <optimized out>
        temp_error_log = <optimized out>
        showdirectives = <optimized out>
        showcompile = <optimized out>
        def_server_root = 0xce9da77d483 "/var/www"
        confname = 0xce9da7843c0 "/etc/apache2/httpd2.conf"
        process = <optimized out>
        pconf = 0xcec6f92c028
        pcommands = <optimized out>
        error = <optimized out>
        opt = <optimized out>
        opt_arg = 0x0
        c = 0 '\000'
        rv = <optimized out>
        plog = 0x0
        ptemp = 0x0
        signal_server = <optimized out>
        mod = <optimized out>

@devnexen
Copy link
Member

devnexen commented Mar 5, 2022

Would it be possible for you to create an additional patch in your repository named patch-ex_opcache_ZendAccelerator_c with the following content (for the 8.0.15 version) :

diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 6883979e7d..21f92755be 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2941,7 +2941,7 @@ static int accel_startup(zend_extension *extension)
zend_post_startup_cb = accel_post_startup;

/* Prevent unloading */
  • extension->handle = 0;
  • //extension->handle = 0;

    return SUCCESS;
    }

and try with a new build ? Just to check something

@unix-world
Copy link
Author

unix-world commented Mar 6, 2022

I was looking over the changes between PHP 7.3 / 7.4 / 8.0 in ZendAccelerator.c, especially on the parts that handle the SIGKILL.

In 7.3 appears:
if (kill(mem_usage_check->l_pid, SIGKILL)) {
and in 7.4 and 8.0 was changed to

if (kill(mem_usage_check->l_pid, signal)) {
/* If SIGTERM was not sufficient, use SIGKILL. */
signal = SIGKILL;

@dstogov
Copy link
Member

dstogov commented Mar 7, 2022

@unix-world can you please check if graceful Apache restart (kill -USR1) works or not.

@unix-world
Copy link
Author

unix-world commented Mar 7, 2022

I've just checked.
kill -USR1 1234 still crashes the apache2 ...

@unix-world
Copy link
Author

but kill -TERM 1234 does not crash apache2 ...

@unix-world
Copy link
Author

unix-world commented Mar 7, 2022

OpenBSD is not using systemd.
It is using SystemV like scripts ... but in the way of other BSD platforms (NetBSD or FreeBSD).

The content of /etc/rc.d/apache2 startup script:

#!/bin/ksh
#
# $OpenBSD: apache2.rc,v 1.6 2020/12/13 08:45:14 giovanni Exp $

daemon="/usr/local/sbin/httpd2"

. /etc/rc.d/rc.subr

# mod_perl resets $0 to argv[0]
pexp=".*${daemon}.*"
rc_reload=NO

rc_start() {
	/usr/local/sbin/apachectl2 graceful ${daemon_flags}
}

rc_stop() {
	/usr/local/sbin/apachectl2 graceful-stop ${daemon_flags}
}

rc_cmd $1

Thus when doing rcctl restart apache2 it uses /usr/local/sbin/apachectl2 graceful-stop which as appears in the logs, will do [mpm_prefork:notice] [pid 80895] AH00170: caught SIGWINCH, shutting down gracefully

If I try kill -WINCH 1234 will also not crash apache

@unix-world
Copy link
Author

When building from the source the PHP 8.0,
I recorded several warnings I have seen:

/_PORTS/pobj/php-8.0.16/php-8.0.16/sapi/apache2handler/apache_config.c:213:7: warning: missing field 'func' initializer [-Wmissing-field-initializers]
        {NULL}
             ^
/_PORTS/pobj/php-8.0.16/php-8.0.16/ext/shmop/shmop.c:203:20: warning: result of comparison of constant 9223372036854775807 with expression of type 'int' is always false [-Wtautological-constant-out-of-range-compare]
        if (shm.shm_segsz > ZEND_LONG_MAX) {
            ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
In file included from /_PORTS/pobj/php-8.0.16/php-8.0.16/ext/opcache/jit/zend_jit.c:215:
In file included from ext/opcache/jit/zend_jit_disasm_x86.c:25:
ext/opcache/jit/libudis86/syn.c:144:49: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
        ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                           ~~~~~~~~~~~~         ^~~~~~
                           %+lld
ext/opcache/jit/libudis86/syn.c:151:36: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  ud_asmprintf(u, "0x%" FMT64 "x", addr);
                     ~~~~~~~~~~~   ^~~~
                     %llx
ext/opcache/jit/libudis86/syn.c:184:51: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
          ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                             ~~~~~~~~~~~~         ^~~~~~
                             %+lld
ext/opcache/jit/libudis86/syn.c:192:36: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  ud_asmprintf(u, "0x%" FMT64 "x", v);
                     ~~~~~~~~~~~   ^
                     %llx
ext/opcache/jit/libudis86/syn.c:216:51: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
          ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                             ~~~~~~~~~~~~         ^~~~~~
                             %+lld
ext/opcache/jit/libudis86/syn.c:224:38: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
    ud_asmprintf(u, "0x%" FMT64 "x", v);
                       ~~~~~~~~~~~   ^
                       %llx
ext/opcache/jit/libudis86/syn.c:240:51: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
          ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                             ~~~~~~~~~~~~         ^~~~~~
                             %+lld
ext/opcache/jit/libudis86/syn.c:249:41: warning: format specifies type 'unsigned long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
      ud_asmprintf(u, "-0x%" FMT64 "x", -v);
                          ~~~~~~~~~~~   ^~
                          %llx
ext/opcache/jit/libudis86/syn.c:251:58: warning: format specifies type 'unsigned long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
      ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v);
                           ~~~~~~~~~~~                   ^
                           %llx
9 warnings generated.
In file included from /_PORTS/pobj/php-8.0.16/php-8.0.16/ext/opcache/jit/zend_jit.c:215:
In file included from ext/opcache/jit/zend_jit_disasm_x86.c:25:
ext/opcache/jit/libudis86/syn.c:144:49: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
        ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                           ~~~~~~~~~~~~         ^~~~~~
                           %+lld
ext/opcache/jit/libudis86/syn.c:151:36: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  ud_asmprintf(u, "0x%" FMT64 "x", addr);
                     ~~~~~~~~~~~   ^~~~
                     %llx
ext/opcache/jit/libudis86/syn.c:184:51: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
          ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                             ~~~~~~~~~~~~         ^~~~~~
                             %+lld
ext/opcache/jit/libudis86/syn.c:192:36: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  ud_asmprintf(u, "0x%" FMT64 "x", v);
                     ~~~~~~~~~~~   ^
                     %llx
ext/opcache/jit/libudis86/syn.c:216:51: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
          ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                             ~~~~~~~~~~~~         ^~~~~~
                             %+lld
ext/opcache/jit/libudis86/syn.c:224:38: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
    ud_asmprintf(u, "0x%" FMT64 "x", v);
                       ~~~~~~~~~~~   ^
                       %llx
ext/opcache/jit/libudis86/syn.c:240:51: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
          ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
                             ~~~~~~~~~~~~         ^~~~~~
                             %+lld
ext/opcache/jit/libudis86/syn.c:249:41: warning: format specifies type 'unsigned long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
      ud_asmprintf(u, "-0x%" FMT64 "x", -v);
                          ~~~~~~~~~~~   ^~
                          %llx
ext/opcache/jit/libudis86/syn.c:251:58: warning: format specifies type 'unsigned long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
      ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v);
                           ~~~~~~~~~~~                   ^
                           %llx
9 warnings generated.
/_PORTS/pobj/php-8.0.16/php-8.0.16/sapi/fpm/fpm/fpm_log.c:217:56: warning: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Wformat]
                                                        len2 = snprintf(b, FPM_LOG_BUFFER - len, "%lu", proc.duration.tv_sec * 1000000UL + proc.duration.tv_usec);
                                                                                                  ~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                  %llu
1 warning generated.

@unix-world
Copy link
Author

unix-world commented Mar 8, 2022

Differences between PHP 7.3.33 and 8.0.16 in ext/opcache/ZendAccelerator.c that may cause the crashing issue:

in PHP 8.0.16 (crashing) there is:

zend_result accel_post_deactivate(void)
{
	if (ZCG(cwd)) {
		zend_string_release_ex(ZCG(cwd), 0);
		ZCG(cwd) = NULL;
	}

	if (!ZCG(enabled) || !accel_startup_ok) {
		return SUCCESS;
	}

	zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
	accel_unlock_all();
	ZCG(counted) = 0;

	return SUCCESS;
}

in PHP 7.3.33 (not crashing)

int accel_post_deactivate(void)
{
	if (!ZCG(enabled) || !accel_startup_ok) {
		return SUCCESS;
	}

	zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
	accel_unlock_all();
	ZCG(counted) = 0;

	return SUCCESS;
}

In my opinion (not sure yet) somewhere at these lines the crash is producing for PHP 8.0.16, perhaps in some circumstances cwd is NULL somehow ... because in PHP 8.0 this part is in post-deactivate (crashing) while in PHP 7.3.33 (not crashing) is in a different method :

zend_result accel_post_deactivate(void)
{
	if (ZCG(cwd)) {
		zend_string_release_ex(ZCG(cwd), 0);
		ZCG(cwd) = NULL;
	}

PHP 7.3.33

static void accel_deactivate(void)
{
	/* ensure that we restore function_table and class_table
	 * In general, they're restored by persistent_compile_file(), but in case
	 * the script is aborted abnormally, they may become messed up.
	 */

	if (ZCG(cwd)) {
		zend_string_release_ex(ZCG(cwd), 0);
		ZCG(cwd) = NULL;
	}
}

@unix-world
Copy link
Author

unix-world commented Mar 8, 2022

This bug is somehow similar with the PHP behavior by calling cwd in a class destructor that also (still) fails ...
https://bugs.php.net/bug.php?id=34206 (accessing cwd after destruct).

Thus in my opinion calling (ZCG(cwd)) in post_deactivate (as in PHP 8.0.x) produces the crash ... instead calling it in a separate method like in PHP 7.3.x (accel_deactivate).

I presume this bug is not visible on linux platform (but is still there ...) because the systemd is much more slower (compared with rc.d) on restarting a service like apache ...

@unix-world
Copy link
Author

https://httpd.apache.org/docs/2.4/stopping.html
The kill -HUP is the correct way as apache documentation specify to do when rotating logs.
On kill -HUP is expected as apache will stop all the childrens but the main process will not exit and the "Users of mod_status will notice that the server statistics are set to zero when a HUP is sent".

Until this bug is fixed inside PHP opcache, I can only do rcctl restart apache2 everytime when logs are rotated ... but this is not ok (but only as a temporary fix) because proceeding like this the main process of apache is stopped (incl. childrens) and a completely new process is started when proceeding like this ... and if website visitors are connected they will see a temporary error.

@unix-world
Copy link
Author

unix-world commented Mar 8, 2022

I was also tried a different compile scenario.

I compiled PHP 8.0.16 as above, win an extra additional flag: --enable-zts

In this scenario apache2 refuses to load the PHP opcache.
Without "--enable-zts" it loads the opcache but crashes on kill -HUP / kill -USR1.

If ZTS enabled, everything works OK except opcache ... If I try to load opcache.so apache does not start at all and display the following error in the errors_log:
ld.so: httpd2: relocation error 16 idx 3086

If ZTS flag disabled, without opcache it works just fine. With PHP opcache crashes.
Isn't opcache supposed to work and be threadsafe (if compiled with ZTS ?).

PS: with ZTS enabled, the php-cli also fails with relocation error if opcache is loaded

@unix-world
Copy link
Author

unix-world commented Mar 8, 2022

Update: To make the opcache to function when PHP 8.0 is build with --enable-zts I had to add this flag too: --disable-opcache-jit.

Otherwise apache or php-cli exit with errors if PHP ZTS try to load opcache extension:
ld.so: xxxx: relocation error 16 idx 3086
Is this what you expect ? Or is this another bug ?

@unix-world
Copy link
Author

unix-world commented Mar 9, 2022

@dstogov Could you reproduce the apache crash on SIGHUP or SIGUSR1 bug ?

@unix-world
Copy link
Author

@devnexen is the ld.so: xxxx: relocation error 16 idx 3086 a bug or not ?
If a bug, is related or not with the original bug described here ? If separate bug I can report it as a separate bug

@devnexen
Copy link
Member

devnexen commented Mar 9, 2022

@unix-world

If a bug, is related or not with the original bug described here

  • it is not related, openbsd is not a proper target yet for ZTS build (thus why the packager maintainer did not enable it originally).

you highlighted a lot of concerns not related with the issue at hand but would you be able to create a patch which would replace (same file name as above)

https://github.com/php/php-src/blob/PHP-8.0.16/ext/opcache/ZendAccelerator.c#L771

int signal = SIGTERM;

by

int signal = SIGKILL;

?

normally it should not crash however SIGTERM had been chosen because it can be blocked but just to verify something.

@unix-world
Copy link
Author

unix-world commented Mar 9, 2022

I have tried this and still crashing.
Not the SIGTERM is the problem ...

But I observed that in PHP 8.0 2 extra lines have been added and in PHP 7.3.33 they are not present:

// line # 783
} else if (errno != 0) {
					zend_accel_error(ACCEL_LOG_WARNING, "Failed to send SIGKILL to locker %d: %s", mem_usage_check->l_pid, strerror(errno));

and

// line #795
} else if (errno != 0) {
					zend_accel_error(ACCEL_LOG_WARNING, "Failed to check locker %d: %s", mem_usage_check->l_pid, strerror(errno));

I am trying with this 4 lines commented out, ... I have an idea that here might be the clue, after issuing SIGTERM or SIGKILL the apache may halt the access to logging and here might be a crash perhaps ...

because the other log situations in this code block I could not reproduce but they might be also crashing, but never got yet entered in the if (errno == ESRCH) { where are other 2 calls to zend_accel_error().

Let me try this and I get back.

@unix-world
Copy link
Author

@devnexen

I was trying any of the above scenarios.
int signal = SIGTERM; -> int signal = SIGKILL;
Then commenting out the } else if (errno != 0) { zend_accel_error(...) lines.
Still the same result, crashing on SIGHUP or SIGUSR1, both scenarios.

I was talking with an internal guy here that have some limited C skills and he told me that from what he can see in the debug log the crashing issue comes from accel_startup or start_accel_module methods, thus he presumes everything is fine when doing SIGTERM or SIGHUP, but on SIGHUP actually apache is shuting down then restart all childs, thus he thinks is an issue with restart after SIGHUP not with the closing process on SIGHUP.

#1  0x00000cec80fed18e in start_accel_module () at ext/opcache/zend_accelerator_module.c:518
No locals.
#2  0x00000cec80fdf63f in accel_startup (extension=0xcec16ffe210) at ext/opcache/ZendAccelerator.c:3114
No locals.

Thus I have noticed only one major difference in the logic between PHP 7.3.33 and 8.0.16:
In 7.3.33 the accel_activate method is called in ext/opcache/ZendAccelerator.c, line # 3156
https://github.com/php/php-src/blob/php-7.3.33/ext/opcache/ZendAccelerator.c#L3156

In 8.0.16 the accel_activate method is called in a completely different place:
ext/opcache/zend_accelerator_module.c, line # 507
https://github.com/php/php-src/blob/php-8.0.16/ext/opcache/zend_accelerator_module.c#L507

What is your opinion on this ? I am not aware too much of Zend internal code ...
Should I try to create a patch to call accel_activate in the same place as it was in PHP 7.3.33 ? Does it make sense ?

@devnexen
Copy link
Member

I do not have opinion yet, I ll try to set up this weekend hopefully a separate openbsd VM to be able to "mess up" with packages and debugging unless someone find some clue in the meantime.

@unix-world
Copy link
Author

unix-world commented Mar 10, 2022

@devnexen

OK.
If you cannot reproduce the bug just let me know and I will send you the exact configs I use.
I use OpenBSD since more than 10 years or so, if you need any support for installing, config or others just let me know too. I am very focused to see this bug solved ... :-)

By the way, you can install the binary ports, but in order to compile it from source there are some things you have to know if you don't already know:

  1. the original src ports of OpenBSD 7.0 are too old and have not the latest updates to build from source PHP 8.0.16
  2. the current ports are already targeting OpenBSD 7.1 beta, thus perhaps will fail to build at some packages
  3. the original src ports of OpenBSD 7.0, with updates packages just targeting OpenBSD 7.0 you can find here
    https://codeberg.org/unixman/ports-openbsd-uxm
    (this repo is containing only the changes marked as stable from the ongoing ports and also extra several ports that are not found in the original openbsd ports: ex: unixman/php-mongodb or unixman/php-xdebug)
  4. or you can download and use original OpenBSD 7.0 src ports but you have to update from the current src ports some packages like: zstd, apr, apr-utils, apache-httpd, php and some others they depend on
  5. an alternative also would be you install all binary ports except PHP and use and updated src ports for PHP to start build 8.0.16 (but not sure exactly if all dependencies are met).

I can confirm that also the original ports built by the package maintainers have this bug. I get the email messages with one of the maintainers. He told me that this is for sure something inside PHP opcache that changed.

PS: also be sure to use the llvm 11, which is the default compiler (not gcc)

R.

@dstogov
Copy link
Member

dstogov commented Mar 11, 2022

@unix-world I suspect, the crash is related to Apache graceful restart and dynamic loading of php and opcache. According to backtrace opcache can't call back to PHP from accel_startup(). I don't have OpenBSD installation and can't reproduce the problem,

@dstogov dstogov closed this as completed Mar 11, 2022
@dstogov
Copy link
Member

dstogov commented Mar 11, 2022

@unix-world

The best backtrace shows crash under start_accel_module(), but this function just forwards to zend_startup_module(), that is not in backtrace.

Try to attach GDB/LLDB to the main Apache process, set breakpoint on start_accel_module() and then try to understand what is going wrong after restart. It's also possible to add some instrumentation code into start_accel_module() to write address of zend_startup_module and accel_module_entry into Apache error log.

@unix-world
Copy link
Author

unix-world commented Mar 11, 2022

@dstogov
Based on your explanation, I am not sure this is all ...
Why the PHP 7.3.33 does not crash with the exactly same apache build and exactly same configuration ?
I currently have 4 versions of PHP all installed:
7.3.33
7.4.28
8.0.16
8.1.3
Except PHP 7.3.33 all the rest are crashing (7.4.28 / 8.0.16 / 8.1.3).
Apache is the same, 2.4.52. When switching from a PHP version to another I just change one thing - the PHP configuration for apache, in the apache configuration is 100% identical. More, to test I loaded just opcache.so extension for any of these versions.
See the only configs I change when switching between the PHP versions:

LoadModule php7_module /usr/local/lib/php-7.3/libphp7.so
<IfModule mod_php7.c>
	AddType application/x-httpd-php .php .phtml .php3
	AddType application/x-httpd-php-source .phps
# Most php configs require this
	DirectoryIndex index.php
</IfModule>

LoadModule php7_module /usr/local/lib/php-7.4/libphp7.so
<IfModule mod_php7.c>
	AddType application/x-httpd-php .php .phtml .php3
	AddType application/x-httpd-php-source .phps
# Most php configs require this
	DirectoryIndex index.php
</IfModule>

LoadModule php_module /usr/local/lib/php-8.0/libphp.so
<IfModule mod_php.c>
	AddType application/x-httpd-php .php .phtml .php3
	AddType application/x-httpd-php-source .phps
# Most php configs require this
	DirectoryIndex index.php
</IfModule>

LoadModule php_module /usr/local/lib/php-8.1/libphp.so
<IfModule mod_php.c>
	AddType application/x-httpd-php .php .phtml .php3
	AddType application/x-httpd-php-source .phps
# Most php configs require this
	DirectoryIndex index.php
</IfModule>

All 4 versions are built with exactly the same build options and same platform patches (of course adapted by version).
How can you explain this ?
I noticed all the crashing versions (7.4.x / 8.0.x / 8.1.x) have inside opcache code a major change:
the accel_activate method is called in a completely different place: ext/opcache/zend_accelerator_module.c
but in 7.3.33 which is not crashing
the accel_activate method is called in ext/opcache/ZendAccelerator.c

I suspect is something about this change ... because the opcache JIT is just in 8.0.x and 8.1.x but 7.4.x still crashes and does not have yet the opcache JIT...

@unix-world
Copy link
Author

PS:
I will try to fill up with logging before each execution line and see where it stops ...
Running apache prefork with GDB I am not sure if possible, there are many childs not only the main process running at the same time concurrently and the crashing is when doing SIGHUP which suppose will stop all childs except the main process.
Do you have any idea how to run this under gdb ?

@unix-world
Copy link
Author

I am really confused. You closed this bug without any explanation.

Look at the below bug, it was an older bug reporting approximately the same issue, perhaps still not solved:
https://bugs.php.net/bug.php?id=73901

@unix-world
Copy link
Author

unix-world commented Mar 11, 2022

** And I think the following FreeBSD bug is exactly the same after they switch from PHP 7.3 to 7.4 ... and still unsolved / unfixed in PHP 8.0 / 8.1 !: **
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247487

@unix-world
Copy link
Author

unix-world commented Mar 12, 2022

@devnexen I don't know why this ticket was closed without an answer.
More, this looks like a serious security issue to me.

In my opinion the bug I reported here is because of the new changes in the opcache, in PHP 7.4 / 8.0 and 8.1.
PHP 7.3 is working correctly, without this kind bug.
Somewhere in time it this kind of opcache bugs were fixed, but now appears (in another form) that have come back. Looks to me very similar with this one:
https://bugzilla.redhat.com/show_bug.cgi?id=1314888

I am not a C expert, but this clear looks to me like a "use-after-free error" ...
And probabily is comming from this changed area:

In 7.3.33 the accel_activate method is called in ext/opcache/ZendAccelerator.c, line # 3156
https://github.com/php/php-src/blob/php-7.3.33/ext/opcache/ZendAccelerator.c#L3156

In 8.0.16 the accel_activate method is called in a completely different place:
ext/opcache/zend_accelerator_module.c, line # 507
https://github.com/php/php-src/blob/php-8.0.16/ext/opcache/zend_accelerator_module.c#L507

Please not that I included the PHP 7.4 in this discussion just to exclude the possibility this bug have nothing to do with the opcache JIT (introduced only since 8.0) !
Thus, PHP 7.4 have no opcache JIT and still crashing because it uses a similar way of calling accel_activate in ext/opcache/zend_accelerator_module.c just like PHP 8.0 and 8.1.

@unix-world
Copy link
Author

@dstogov , as you said:

The best backtrace shows crash under start_accel_module(), but this function just forwards to zend_startup_module(), that is not in backtrace.

But please look at this part of the code and you see that accel_activate is called here !!:

PHP 8.0 / 8.1 / 7.4

static zend_module_entry accel_module_entry = {
	STANDARD_MODULE_HEADER,
	ACCELERATOR_PRODUCT_NAME,
	ext_functions,
	ZEND_MINIT(zend_accelerator),
	ZEND_MSHUTDOWN(zend_accelerator),
	accel_activate,  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THIS I AM TALKING ABOUT
	NULL,
	zend_accel_info,
	PHP_VERSION,
	NO_MODULE_GLOBALS,
	accel_post_deactivate,
	STANDARD_MODULE_PROPERTIES_EX
};

int start_accel_module(void)
{
	return zend_startup_module(&accel_module_entry);
}

But in PHP 7.3 (not crashing) is called in completely different place

static zend_module_entry accel_module_entry = {
	STANDARD_MODULE_HEADER,
	ACCELERATOR_PRODUCT_NAME,
	accel_functions,
	ZEND_MINIT(zend_accelerator),
	ZEND_MSHUTDOWN(zend_accelerator),
	NULL, // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THIS I AM TALKING ABOUT
	NULL,
	zend_accel_info,
	PHP_VERSION,
	NO_MODULE_GLOBALS,
	accel_post_deactivate,
	STANDARD_MODULE_PROPERTIES_EX
};

int start_accel_module(void)
{
	return zend_startup_module(&accel_module_entry);
}

In PHP 7.3 the accel_activate is called here

ZEND_EXT_API zend_extension zend_extension_entry = {
	ACCELERATOR_PRODUCT_NAME,               /* name */
	PHP_VERSION,							/* version */
	"Zend Technologies",					/* author */
	"http://www.zend.com/",					/* URL */
	"Copyright (c) 1999-2018",				/* copyright */
	accel_startup,					   		/* startup */
	NULL,									/* shutdown */
	accel_activate,							/* per-script activation */
	accel_deactivate,						/* per-script deactivation */
	NULL,									/* message handler */
	NULL,									/* op_array handler */
	NULL,									/* extended statement handler */
	NULL,									/* extended fcall begin handler */
	NULL,									/* extended fcall end handler */
	NULL,									/* op_array ctor */
	NULL,									/* op_array dtor */
	STANDARD_ZEND_EXTENSION_PROPERTIES
};

@dstogov
Copy link
Member

dstogov commented Mar 14, 2022

I see accel_activate() is going to be called from different places, but I don't see it in the backtrace. So this is not a problem. The crash occurs in start_accel_module(), that is the same for all PHP versions. I can't guess what is going wrong. I suspect issues with dynamic loader.

@unix-world
Copy link
Author

I suspect calling the accel_activate() from the new place in PHP 7.4 / 8.0 / 8.1 which also occurs when calling start_accel_module() could be a cause ... not sure.

@dstogov
Copy link
Member

dstogov commented Mar 14, 2022

You may revert the the commit 34a491d1ed5 to check this.
Anyway, there is nothing wrong with this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants