Skip to content

Segmentation fault when generating composer autoload with 50k+ classes #11795

Closed
@oprypkhantc

Description

@oprypkhantc

Description

Hey.

Running composer dumpautoload --optimize-autoloader twice on a large codebase (50k+ classes it seems) with OPCache enabled in Docker results in a segmentation fault. Changing OPCache settings doesn't seem to do anything.

This is reproducible on a x86_64, but is not reproducible on ARM MacBook. PHP 8.1.9 is also affected.

I've prepared a small repository with reproduction: https://github.com/oprypkhantc/php-composer-segfault/tree/main

docker run -w /app -v "$PWD:/app" -it $(docker build -q .) i --ignore-platform-reqs
docker run -w /app -v "$PWD:/app" -it $(docker build -q .) dump -o
docker run -w /app -v "$PWD:/app" -it $(docker build -q .) dump -o

The first dump -o results in an exit code 0 and this output:

Generating optimized autoload files
Warning: ...
Generated optimized autoload files containing 61131 classes

The second dump -o results in an exit code 139 and this output (notice missing line compared to the first run):

Generating optimized autoload files
Warning: ...

PHP Version

8.2.8

Operating System

Ubuntu 20.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions