View Issue Details

IDProjectCategoryView StatusLast Update
0002036XdebugUncategorizedpublic2021-12-01 15:39
Reporterkelunik Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version3.1.2 
Summary0002036: Segfault on fiber switch in finally block in garbage collected fiber
Description

PHP with xdebug segfaults if a fiber is switched in a finally block in a GCed fiber.

With xdebug:

php test.php
PHP Warning: Undefined property: GracefulExit::$code in /home/kelunik/test.php on line 9
PHP Stack trace:
[1] 680022 segmentation fault (core dumped) php test.php

Without xdebug:

php test.php
PHP Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in /home/kelunik/test.php:11
Stack trace:
#0 /home/kelunik/test.php(11): Fiber->start()
#1 [internal function]: {closure}()
0000002 {main}
thrown in /home/kelunik/test.php on line 11

Steps To Reproduce

<?php

$fiberA = new Fiber(function () {
Fiber::suspend();
});

$fiberB = new Fiber(function () use ($fiberA) {
try {
Fiber::suspend();
} finally {
$fiberA->start();
}
});

$fiberB->start();

Tagscrash, SIGSEGV
Operating System
PHP Version8.1-dev

Relationships

has duplicate 0002046 closedderick Segault on xdebug_get_function_stack inside a Fiber 

Activities

derick

2021-10-19 15:23

administrator   ~0006123

I can't reproduce this crash, could you run this after adding xdebug_info() as first line, and attach the output as an attachment?

Which Xdebug version are you using?

kelunik

2021-10-19 18:10

reporter   ~0006124

Sure! v3.1.1, see attached output.

xdebug_info.txt (3,478 bytes)   
__   __   _      _                 
\ \ / /  | |    | |                
 \ V / __| | ___| |__  _   _  __ _ 
  > < / _` |/ _ \ '_ \| | | |/ _` |
 / . \ (_| |  __/ |_) | |_| | (_| |
/_/ \_\__,_|\___|_.__/ \__,_|\__, |
                              __/ |
                             |___/ 

Version => 3.1.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

                              Diagnostic Log                              
No messages

                                   PHP                                   
                           Build Configuration                           
Version (Run Time) => 8.1.0RC4
Version (Compile Time) => 8.1.0RC4
Debug Build => no
Thread Safety => disabled
                                 Settings                                 
Configuration File (php.ini) Path => /etc/php
Loaded Configuration File => /etc/php/php.ini
Scan this dir for additional .ini files => /home/kelunik/.phpenv/versions/8.1.0RC4
Additional .ini files parsed => /home/kelunik/.phpenv/versions/8.1.0RC4/php.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.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 => 256 => 256
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 => no value => no value
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_return => Off => Off

xdebug_info.txt (3,478 bytes)   

derick

2021-10-21 10:10

administrator   ~0006132

https://github.com/xdebug/xdebug/pull/808

derick

2021-10-27 10:21

administrator   ~0006145

Fixed in Git, for 3.1.2.

Issue History

Date Modified Username Field Change
2021-10-18 22:40 kelunik New Issue
2021-10-18 22:40 kelunik Tag Attached: crash
2021-10-18 22:40 kelunik Tag Attached: SIGSEGV
2021-10-19 15:23 derick Assigned To => derick
2021-10-19 15:23 derick Status new => feedback
2021-10-19 15:23 derick Note Added: 0006123
2021-10-19 18:10 kelunik Note Added: 0006124
2021-10-19 18:10 kelunik File Added: xdebug_info.txt
2021-10-19 18:10 kelunik Status feedback => assigned
2021-10-21 10:10 derick Note Added: 0006132
2021-10-27 10:21 derick Status assigned => closed
2021-10-27 10:21 derick Resolution open => fixed
2021-10-27 10:21 derick Fixed in Version => 3.1dev
2021-10-27 10:21 derick Note Added: 0006145
2021-11-24 10:19 derick Relationship added has duplicate 0002046
2021-12-01 15:39 derick Fixed in Version 3.1dev => 3.1.2