[php-src] Issue #10477: Cannot declare class because the name is already in use when using opcache preloading

From: Date: Tue, 31 Jan 2023 11:25:08 +0000
Subject: [php-src] Issue #10477: Cannot declare class because the name is already in use when using opcache preloading
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243596@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10477
Author: danog

### Description

We're getting PHP Fatal error:  Cannot declare class
ComposerAutoloaderInit2ebcbf27beff2f3405a1f59aba63272d, because the name is already in use in
/path/to/vendor/composer/autoload_real.php on line 5 errors in production, only when using
opcache preloading.

The issue occurs randomly, and when it does it goes on for a few minutes, before going away by
itself.
For example, last time it started occuring at 30-Jan-2023 09:48:33, then, 16203 errors
later, it stopped at 30-Jan-2023 09:51:33.

This is our opcache config:

```
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=512
opcache.jit_buffer_size=512M
opcache.jit=off ; Was turned off due to other segfaults
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=1000000
opcache.validate_timestamps=0
opcache.dups_fix=1
opcache.blacklist_filename=/path/to/opcache_blacklist
opcache.error_log=/logs/opcache.log
opcache.log_verbosity_level=4
opcache.preload=/zoon/zoon/preload.php
opcache.preload_user=www-data
opcache.file_update_protection=0
```

The opcache logs only contain 4 loading blacklist file lines, the first and closest one occurring at
30-Jan-2023 09:56:45, 5 minutes after the last Cannot declare class error.

We enabled preloading to try to fix the segfaults caused by the inheritance cache in https://github.com/php/php-src/issues/10070;
this seems to have fixed the segfaults, but caused these issues instead.

I assume the root cause is similar to the one in #10070: something is triggering a re-parse of
already cached files.

### PHP Version

PHP 8.1.14, 8.1.13

### Operating System

Ubuntu 20.04, ondrej repos


Thread (1 message)

  • danog
« previous php.bugs (#243596) next »