RTD collision with opcache
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Symfony |
Fix Released
|
Unknown
|
|||
php |
Unknown
|
Unknown
|
|||
php7.4 (Ubuntu) |
Invalid
|
Undecided
|
Athos Ribeiro | ||
Focal |
Fix Released
|
Undecided
|
Athos Ribeiro |
Bug Description
[Impact]
As explained in https:/
OPcache improves PHP performance by storing precompiled bytecode in shared memory, removing the need to load and parse scripts on each request.
A bug in PHP OPcache code (https:/
The fix is available upstream at https:/
[Test Plan]
Use the following script to reproduce the issue on a focal environment with php7.4 installed:
BEGIN_REPRODUCER
#!/bin/bash
PHP_TMP_
PHP_CACHE_
PHP_FILE1=
PHP_FILE2=
mkdir -p "${PHP_CACHE_DIR}"
# prints information about the current php environment
# php -d opcache.
cat > "${PHP_FILE1}" <<EOF
<?php
return function() {};
EOF
cat > "${PHP_FILE2}" <<EOF
<?php
\$file = '${PHP_FILE1}';
var_dump(include \$file);
touch(\$file);
var_dump(include \$file);
EOF
sleep 5
php -d opcache.
php -d opcache.
# clean up
rm -rf "${PHP_TMP_DIR}"
END_REPRODUCER
Re-run the reproducer after installing the proposed fix to ensure the new package is no longer affected.
[Where problems could occur]
While the patch being proposed seems to be straightforward, it was applied on top of two other patches in Zend/zend_compile.c and will be back-ported (it does apply on different lines without changes). This may lead to unpredicted code-paths being executed, triggering possible bugs not seen upstream.
The set of patches is small enough and if needed, we could apply the whole set to make the codepaths closer to what upstream intended for PHP 7.4.7.
$ git log --oneline PHP-7.4.
4f47ba99f0 Fix bug #79603, by retrying on RTD key collision
c5159b3832 Check asserts early
2dddab01ae Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script
Moreover, recompiling PHP linking it to possible new versions of libraries that may have been SRU'd could trigger unwanted behaviors which were not observed before.
[Other Info]
This bug was fixed in php 7.4.7 and is not present in Ubuntu releases other than focal.
[Original message]
As described in PHP bug #79603, it is possible to cause opcache collisions that result in a fatal error.
https:/
It has been fixed in this upstream commit:
https:/
The changes to zend_compile.c apply cleanly, just at different line numbers.
This has been reproduced on Ubuntu 20.04 with version 7.4.3-4ubuntu2.8 of php7.4-opcache installed.
Related branches
- Bryce Harrington (community): Approve
- Canonical Server packageset reviewers: Pending requested
-
Diff: 112 lines (+90/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/0048-Fix-bug-79603-by-retrying-on-RTD-key-collision.patch (+82/-0)
debian/patches/series (+1/-0)
tags: | added: server-todo |
tags: | added: cpc-newcomer |
Changed in php7.4 (Ubuntu): | |
assignee: | nobody → Athos Ribeiro (athos-ribeiro) |
Changed in symfony: | |
status: | Unknown → Fix Released |
description: | updated |
Changed in php7.4 (Ubuntu): | |
status: | Confirmed → In Progress |
Status changed to 'Confirmed' because the bug affects multiple users.