Skip to content

1.12.7 worker mode: SIGSEGV in zend_unfinished_execution_gc after an opcache restart (since #2564 removed the restart hook) #2638

Description

@petr-buchin

What happens

A Symfony 8 API running in worker mode (worker /app/public/index.php 4, symfony/runtime 8.1) dies with SIGSEGV after some uptime. The core dump's top frames are zend_unfinished_execution_gczend_generator_get_gcgc_collect_cycles, called from symfony/runtime's FrankenPhpWorkerRunner, which runs gc_collect_cycles() after every request. The same application on regular (non-worker) threads never crashes. Serving the crashing endpoint has nothing special about it: no fibers, no retained generators, no shutdown functions.

Environment

  • FrankenPHP 1.12.7 (official dunglas/frankenphp:1-php8.5-bookworm), PHP 8.5.9 ZTS, linux/arm64
  • opcache.jit=function, otherwise default opcache settings
  • no pecl_http / raphf

What we believe is going on

This is the mechanism described in #2621: accel_is_inactive() probes with POSIX fcntl locks, which never conflict inside one process, so the deferred opcache restart is carried out at the next RINIT on any thread while workers keep running. Workers never reach accel_post_deactivate, so their op_arrays and interned strings are recycled underneath them, and the next gc_collect_cycles() walks a live frame through stale pointers.

Version bisect on the same image line: 1.12.6 (which still has the reboot hook from #2364) does not crash for us; 1.12.7 (#2564 removed the hook) does. We do not load pecl_http, the extension behind the deadlock reports in #2568 that motivated the removal.

Why I am filing this

#2621 was closed on 2026-09-06 in favour of #2634 (the log line), with a note that field reports arrive as "segfault" or "slow" with nothing tying them to an opcache restart. This one is tied to it: worker mode + an opcache restart + a GC pass after the request = SIGSEGV, reproducible on 1.12.7, gone on 1.12.6. Is there an issue tracking the crash itself, and would the hook be acceptable behind an opt-in setting for deployments that do not load pecl_http, until php-src handles thread-safe restarts (php/php-src#22281)?

Workarounds that work for us

  • pin 1.12.6 (no pecl_http in the image), or
  • run the same app without the worker directive, or
  • size opcache.memory_consumption / opcache.interned_strings_buffer so a restart never happens (fragile: an invisible restart is exactly what fix: log and count opcache restarts #2634 addresses).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions