View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002328 | Xdebug | Uncategorized | public | 2025-03-07 07:34 | 2025-08-29 08:55 |
Reporter | tenzap | Assigned To | derick | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 3.4.1 | ||||
Target Version | 3.4dev | Fixed in Version | 3.4dev | ||
Summary | 0002328: Stream resource references in stored stack traces don't hold, and can cause crashes | ||||
Description | Running the tests of php-league-csv leads to crash.
Running it with | ||||
Steps To Reproduce | Run the test suite of https://github.com/thephpleague/csv/ version 9.22.0 Command: vendor/bin/phpunit --exclude-group network --no-coverage You could also try this command which results into the same crash: composer run-script phpunit-min Be sure to not have XDEBUG_MODE=coverage, because when it is set, the tests don't fail. If Xdebug is not installed, it doesn't fail either. Output is PHPUnit 11.5.11 by Sebastian Bergmann and contributors. Runtime: PHP 8.4.4 ............................................................... 63 / 678 ( 9%) I also attach the output of valgrind, invoked with various parameters. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Operating System | Debian trixie | ||||
PHP Version | 8.4-dev | ||||
|
There is a typo. It's not composer run-script phpunit-min but composer run-script phpunit:min |
|
Hi, I can't seem to be able to reproduce this.
cheers, |
|
xdebug_info.txt (5,279 bytes)
[1m__ __ _ _ [1m\ \ / / | | | | [1m \ V / __| | ___| |__ _ _ __ _ [1m > < / _` |/ _ \ '_ \| | | |/ _` | [1m / . \ (_| | __/ |_) | |_| | (_| | [1m/_/ \_\__,_|\___|_.__/ \__,_|\__, | [1m __/ | [1m |___/ [0mVersion => 3.4.1 Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support Enabled Features (through 'xdebug.mode' setting) Feature => Enabled/Disabled Development Helpers => ✔ enabled Coverage => ✘ disabled GC Stats => ✘ disabled Profiler => ✘ disabled Step Debugger => ✘ disabled Tracing => ✘ disabled Optional Features Compressed File Support => yes (gzip) Clock Source => clock_gettime TSC Clock Source => unavailable 'xdebug://gateway' pseudo-host support => yes 'xdebug://nameserver' pseudo-host support => yes Systemd Private Temp Directory => not enabled Diagnostic Log [Config] WARN: Not setting up control socket with default value due to unavailable 'tsc' clock PHP Build Configuration Version (Run Time) => 8.4.4 Version (Compile Time) => 8.4.3 Debug Build => no Thread Safety => disabled Settings Configuration File (php.ini) Path => /etc/php/8.4/cli Loaded Configuration File => /etc/php/8.4/cli/php.ini Scan this dir for additional .ini files => /etc/php/8.4/cli/conf.d Additional .ini files parsed => /etc/php/8.4/cli/conf.d/10-mysqlnd.ini, /etc/php/8.4/cli/conf.d/10-opcache.ini, /etc/php/8.4/cli/conf.d/10-pdo.ini, /etc/php/8.4/cli/conf.d/15-xml.ini, /etc/php/8.4/cli/conf.d/20-calendar.ini, /etc/php/8.4/cli/conf.d/20-ctype.ini, /etc/php/8.4/cli/conf.d/20-curl.ini, /etc/php/8.4/cli/conf.d/20-dom.ini, /etc/php/8.4/cli/conf.d/20-exif.ini, /etc/php/8.4/cli/conf.d/20-ffi.ini, /etc/php/8.4/cli/conf.d/20-fileinfo.ini, /etc/php/8.4/cli/conf.d/20-ftp.ini, /etc/php/8.4/cli/conf.d/20-gettext.ini, /etc/php/8.4/cli/conf.d/20-iconv.ini, /etc/php/8.4/cli/conf.d/20-intl.ini, /etc/php/8.4/cli/conf.d/20-mbstring.ini, /etc/php/8.4/cli/conf.d/20-mysqli.ini, /etc/php/8.4/cli/conf.d/20-pdo_mysql.ini, /etc/php/8.4/cli/conf.d/20-pdo_pgsql.ini, /etc/php/8.4/cli/conf.d/20-pdo_sqlite.ini, /etc/php/8.4/cli/conf.d/20-pgsql.ini, /etc/php/8.4/cli/conf.d/20-phar.ini, /etc/php/8.4/cli/conf.d/20-posix.ini, /etc/php/8.4/cli/conf.d/20-readline.ini, /etc/php/8.4/cli/conf.d/20-shmop.ini, /etc/php/8.4/cli/conf.d/20-simplexml.ini, /etc/php/8.4/cli/conf.d/20-sockets.ini, /etc/php/8.4/cli/conf.d/20-sqlite3.ini, /etc/php/8.4/cli/conf.d/20-sysvmsg.ini, /etc/php/8.4/cli/conf.d/20-sysvsem.ini, /etc/php/8.4/cli/conf.d/20-sysvshm.ini, /etc/php/8.4/cli/conf.d/20-tokenizer.ini, /etc/php/8.4/cli/conf.d/20-xdebug.ini, /etc/php/8.4/cli/conf.d/20-xmlreader.ini, /etc/php/8.4/cli/conf.d/20-xmlwriter.ini, /etc/php/8.4/cli/conf.d/20-xsl.ini, /etc/php/8.4/cli/conf.d/20-zip.ini Directive => Local Value => Master Value xdebug.mode => develop => develop xdebug.start_with_request => default => default xdebug.start_upon_error => default => default xdebug.output_dir => /tmp => /tmp xdebug.use_compression => 1 => 1 xdebug.trigger_value => no value => no value xdebug.file_link_format => no value => no value xdebug.filename_format => no value => no value xdebug.control_socket => off => off xdebug.log => no value => no value xdebug.log_level => 7 => 7 xdebug.var_display_max_children => 128 => 128 xdebug.var_display_max_data => 512 => 512 xdebug.var_display_max_depth => 3 => 3 xdebug.max_nesting_level => 512 => 512 xdebug.cli_color => 0 => 0 xdebug.force_display_errors => Off => Off xdebug.force_error_reporting => 0 => 0 xdebug.halt_level => 0 => 0 xdebug.max_stack_frames => -1 => -1 xdebug.show_error_trace => Off => Off xdebug.show_exception_trace => Off => Off xdebug.show_local_vars => Off => Off xdebug.dump.COOKIE => no value => no value xdebug.dump.ENV => no value => no value xdebug.dump.FILES => no value => no value xdebug.dump.GET => no value => no value xdebug.dump.POST => no value => no value xdebug.dump.REQUEST => no value => no value xdebug.dump.SERVER => no value => no value xdebug.dump.SESSION => no value => no value xdebug.dump_globals => On => On xdebug.dump_once => On => On xdebug.dump_undefined => Off => Off xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p xdebug.profiler_append => Off => Off xdebug.cloud_id => no value => no value xdebug.client_host => localhost => localhost xdebug.client_port => 9003 => 9003 xdebug.discover_client_host => Off => Off xdebug.client_discovery_header => HTTP_X_FORWARDED_FOR,REMOTE_ADDR => HTTP_X_FORWARDED_FOR,REMOTE_ADDR xdebug.idekey => no value => no value xdebug.connect_timeout_ms => 200 => 200 xdebug.scream => Off => Off xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p xdebug.trace_output_name => trace.%c => trace.%c xdebug.trace_format => 0 => 0 xdebug.trace_options => 0 => 0 xdebug.collect_assignments => Off => Off xdebug.collect_params => On => On xdebug.collect_return => Off => Off |
|
By the way it also fais on debian's CI, so my system is not particularly in cause. |
|
I found that: test suite succeeds with test suite crashes when xdebug.mode is not set, which corresponds to |
|
This bug is still present in 3.4.2 |
|
I tested again with xdebug 3.4.5 & php 8.4.11 on Debian trixie and it still fails. |
|
Hi, So I have tried again now — first on Trixie, and then later locally again, and I can now indeed reproduce it. Using I also need to run it with valgrind, like:
This produces the following warning (as first):
This provides the following hints. From
And this allocation gets freed in the
These two together show that the stream resource opened with Then Xdebug later uses this freed memory when it tries to show an exception ( However, I can't quite see how this happens, as I do increase the ref count for the exceptions when they get caught. But for some reason the refcount for the stream resource is not affected by this, and gets freed regardless. Reducing this test case is not so easy, as the freeing of this exception that Xdebug keeps hold of only happens after 8 other exceptions. However, the fix is easy, and I've made a PR: https://github.com/xdebug/xdebug/pull/1033 |
|
@tenzap — it would be nice if you could test the |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-03-07 07:34 | tenzap | New Issue | |
2025-03-07 07:34 | tenzap | File Added: valgrind--leak-check=full--show-leak-kinds=all.log.xz | |
2025-03-07 07:34 | tenzap | File Added: valgrind--leak-check=full.log.xz | |
2025-03-07 07:34 | tenzap | File Added: valgrind.log.gz | |
2025-03-07 07:36 | tenzap | Note Added: 0007196 | |
2025-03-07 12:07 | derick | Assigned To | => derick |
2025-03-07 12:07 | derick | Status | new => feedback |
2025-03-07 12:07 | derick | Note Added: 0007198 | |
2025-03-07 12:33 | tenzap | Note Added: 0007202 | |
2025-03-07 12:33 | tenzap | File Added: xdebug_info.txt | |
2025-03-07 12:33 | tenzap | Status | feedback => assigned |
2025-03-07 12:34 | tenzap | Note Added: 0007203 | |
2025-03-07 12:53 | tenzap | Note Added: 0007204 | |
2025-03-13 07:55 | tenzap | Note Added: 0007213 | |
2025-08-16 15:24 | tenzap | Note Added: 0007347 | |
2025-08-27 14:05 | derick | Note Added: 0007348 | |
2025-08-27 14:07 | derick | Target Version | => 3.4dev |
2025-08-27 14:07 | derick | Summary |
tests failing with zend_mm_heap corrupted => Stream resource references in stored stack traces don't hold, and can cause crashes |
2025-08-27 15:02 | derick | Status | assigned => closed |
2025-08-27 15:02 | derick | Resolution | open => fixed |
2025-08-27 15:02 | derick | Fixed in Version | => 3.4dev |
2025-08-29 08:55 | derick | Note Added: 0007350 |