View Issue Details

IDProjectCategoryView StatusLast Update
0002036XdebugUncategorizedpublic2021-12-01 15:39
Reporterkelunik Assigned To 
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.

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.