8000 Core dumped in Zend/zend_generators.c · Issue #15866 · php/php-src · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Core dumped in Zend/zend_generators.c #15866

Closed
YuanchengJiang opened this issue Sep 13, 2024 · 4 comments
Closed

Core dumped in Zend/zend_generators.c #15866

YuanchengJiang opened this issue Sep 13, 2024 · 4 comments

Comments

@YuanchengJiang
Copy link
8000

Description

The following code:

<?php
$db = new Pdo\Sqlite('sqlite::memory:');
class Canary {
public function __construct(public mixed $fusion) {}
}
function g() {
Fiber::suspend();
}
function f($canary) {
var_dump(yield from g());
}
$canary = new Canary(null);
$iterable = f($canary);
$fiber = new Fiber(function () use ($iterable, $canary) {
$f = $iterable->next(...);
$f();
});
$canary->value = $fiber;
$fiber->start();
$fiber = $iterable = $canary = null;
gc_collect_cycles();

Resulted in this output:

/php-src/Zend/zend_generators.c:218: check_node_running_in_fiber: Assertion `(executor_globals.flags) & (1<<0)' failed.
Aborted (core dumped)

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

@DanielEScherzer
Copy link
Contributor

Minimal reproduction:

<?php
$db = new Pdo\Sqlite('sqlite::memory:');

function f() {
    yield from Fiber::suspend();
}
$canary = new stdClass();
$iterable = f($canary);
$fiber = new Fiber(function () use ($iterable) {
    $iterable->next();
});
$canary->value = $fiber;
$fiber->start();
$fiber = $iterable = $canary = null;
gc_collect_cycles();

Even removing the Sqlite database is enough for this to not fail, maybe that should be tagged with that label?

@nielsdos
Copy link
Member

No, it seems you just need something that triggers a get_gc handler, and Pdo\Sqlite has a custom get_gc. So it's not directly related to that class.
Anyway, cc @arnaud-lb since this code is his domain.

@arnaud-lb
Copy link
Member

Indeed. The get_gc handler has the effect of changing the traversal order of the graph, and so of the dtor order.

@arnaud-lb
Copy link
Member
arnaud-lb commented Oct 2, 2024

Fixed by #16025.

Thank you @YuanchengJiang!

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

5 participants
0