Skip to content

Functional tests crash randomly with a segmentation fault on PHP 8.2 #899

Done

Description

@d-g-codappix

The functional tests crash randomly with a segmentation fault (exit code 139) on PHP 8.2, in CI and locally, e.g. in #898 while preparing DeprecatedClassAliasesTest.

Valgrind shows a use-after-free in serialize(): during an outer serialize() the garbage collector destroys an object whose destructor calls serialize() again. The nested call resizes and frees the internal reference table of the outer call, which still uses it.

The destructor is TYPO3\CMS\Extbase\Reflection\ReflectionService::__destruct(), it writes the class schemata to the cache (VariableFrontend::set() → serialize()). Reflection services of earlier test instances are part of reference cycles and are collected at a random point during later tests.

Proposal (workaround in the tests):

  • A PHPUnit extension disables the automatic garbage collection and calls gc_collect_cycles() after the set up of each test and after each test, so the destructors never run inside another serialize().

The underlying problem (cache write with serialize() in a destructor, nested serialize() during garbage collection) is to be reported to TYPO3 and PHP separately.

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