php / php/php-src

Assertion failure in check_node_running_in_fiber() when resuming a generator inside a Fiber destructor

Open
#20,615 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Engine Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
class a {
    static $b;
    static $max = 5.;
    function __destruct() {
        $a  = new a;
        static $gen = (function() {
            $from = (function () {
                $a = new a;
                yield;
            })();
            try {
                yield from $from;
            } finally {
            }
        })();
        $fiber = new Fiber(function () use ($gen, &$fiber) {
            $gen->next();
        });
        $fiber->start();
    }
}
new a;

Resulted in this output:

php: /path/to/php-src/Zend/zend_generators.c:217: _Bool check_node_running_in_fiber(zend_generator *): Assertion `generator->execute_data' failed.
Aborted

Commit:

56795d2810e

Build configuration:

CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" LDFLAGS="-fsanitize=address" ./buildconf --force && ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib
PHP Version
PHP 8.6.0-dev (cli) (built: Nov 29 2025 14:32:34) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
Operating System

Ubuntu 22.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Zend/zend_generators.c around check_node_running_in_fiber() line 217, then reproduce the provided script with the debug and AddressSanitizer configuration. Trace the generator and Fiber lifecycle during object destruction; done means the reproducer no longer aborts on the assertion and regression coverage verifies the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.