You can enter the container (it stays up after segfaulting) if you want to run the script with gdb:
docker exec -it phalcon-memprof-test-1 /bin/bash
Trace with gdb:
# gdb --args php index.php
GNU gdb (Debian 13.1-3) 13.1
[...]
Reading symbols from php...
(No debugging symbols found in php)
(gdb) run
Starting program: /usr/local/bin/php index.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
bool(true)
Program received signal SIGSEGV, Segmentation fault.
0x0000fffff3f84fe4 in get_function_name (execute_data=execute_data@entry=0xfffff40142e0,
buf=buf@entry=0xffffffffa560 "\377", buf_size=buf_size@entry=256) at /tmp/pear/temp/memprof/util.c:70
70 /tmp/pear/temp/memprof/util.c: No such file or directory.
(gdb) backtrace
#0 0x0000fffff3f84fe4 in get_function_name (execute_data=execute_data@entry=0xfffff40142e0,
buf=buf@entry=0xffffffffa560 "\377", buf_size=buf_size@entry=256) at /tmp/pear/temp/memprof/util.c:70
#1 0x0000fffff3f83fd8 in get_or_create_frame (
current_execute_data=current_execute_data@entry=0xfffff40142e0, prev=0xaaaaabe99700)
at /tmp/pear/temp/memprof/memprof.c:456
#2 0x0000fffff3f8429c in memprof_zend_execute (execute_data=0xfffff40142e0)
at /tmp/pear/temp/memprof/memprof.c:740
#3 0x0000aaaaaaf4737c in zend_execute ()
#4 0x0000fffff397cb38 in zephir_require_once_ret (return_value_ptr=0x0,
require_path=0xfffff4058d38 "/var/www/test/app/TestClass.php", return_value_ptr=0x0)
at /tmp/pear/temp/phalcon/phalcon.zep.c:8975
#5 0x0000fffff3ad8908 in zephir_require_once_zval (require_path=0xffffffffa820)
at /tmp/pear/temp/phalcon/phalcon.zep.c:3100
#6 zim_Phalcon_Autoload_Loader_requireFile (execute_data=<optimized out>, return_value=0xffffffffae50)
at /tmp/pear/temp/phalcon/phalcon.zep.c:21383
#7 0x0000fffff3f8421c in memprof_zend_execute_internal (execute_data_ptr=0xfffff4014280,
return_value=0xffffffffae50) at /tmp/pear/temp/memprof/memprof.c:788
#8 0x0000aaaaaaeb6a50 in zend_call_function ()
#9 0x0000fffff396abd4 in zephir_call_user_function (object_pp=object_pp@entry=0xfffff4014230,
obj_ce=obj_ce@entry=0xaaaaabca0390, type=type@entry=zephir_fcall_method,
function_name=function_name@entry=0xffffffffac50, retval_ptr=retval_ptr@entry=0xffffffffae50,
cache_entry=cache_entry@entry=0xffffffffad48, cache_slot=cache_slot@entry=0,
param_count=param_count@entry=1, params=0xffffffffaf30) at /tmp/pear/temp/phalcon/phalcon.zep.c:8575
#10 0x0000fffff396b484 in zephir_call_class_method_aparams (
return_value=return_value@entry=0xffffffffae50, ce=0xaaaaabca0390
To fix it either:
remove these lines from docker-compose.yml
environment:
- MEMPROF_PROFILE=dump_on_limit
remove include("vendor/autoload.php"); from index.php
Description
Link to phalcon
Repr steps:
docker-compose build
docker-compose up
Resulted in this output:
But I expected this output instead:
You can enter the container (it stays up after segfaulting) if you want to run the script with
gdb
:docker exec -it phalcon-memprof-test-1 /bin/bash
Trace with gdb:
To fix it either:
include("vendor/autoload.php");
from index.phpphp-memprof Version
3.0.2
PHP Version
php 8.1.27
Operating System
debian under docker