forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.2: [ci skip] NEWS Log the cause of error when opcache cannot write to file cache (php#9258) Fix high opcache.interned_strings_buffer causing shm corruption (php#9260)
- Loading branch information
Showing
8 changed files
with
168 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--TEST-- | ||
File cache error 001 | ||
--EXTENSIONS-- | ||
opcache | ||
posix | ||
pcntl | ||
--INI-- | ||
opcache.enable_cli=1 | ||
opcache.file_cache={TMP} | ||
opcache.log_verbosity_level=2 | ||
--SKIPIF-- | ||
<?php | ||
if (!posix_setrlimit(POSIX_RLIMIT_FSIZE, 1, 1)) die('skip Test requires setrlimit(RLIMIT_FSIZE) to work'); | ||
if (ini_parse_quantity(ini_get('opcache.jit_buffer_size')) !== 0) die('skip File cache is disabled when JIT is on'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
// Create new file to ensure that it's not cached accross test runs | ||
$file = tempnam(sys_get_temp_dir(), 'file_cache_error'); | ||
register_shutdown_function(function () use ($file) { | ||
unlink($file); | ||
}); | ||
file_put_contents($file, '<?php echo "OK";'); | ||
touch($file, time() - 3600); | ||
|
||
// Some systems will raise SIGXFSZ when RLIMIT_FSIZE is exceeded | ||
if (defined('SIGXFSZ')) { | ||
pcntl_signal(SIGXFSZ, SIG_IGN); | ||
} | ||
|
||
// Should cause writing to cache file to fail | ||
var_dump(posix_setrlimit(POSIX_RLIMIT_FSIZE, 1, 1)); | ||
|
||
// Will attempt to write to cache file, and fail | ||
require $file; | ||
?> | ||
--EXPECTF-- | ||
bool(true) | ||
%sWarning opcache cannot write to file %s: %s | ||
|
||
OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--TEST-- | ||
Bug GH-9259 001 (Setting opcache.interned_strings_buffer to a very high value leads to corruption of shm) | ||
--EXTENSIONS-- | ||
opcache | ||
--INI-- | ||
opcache.interned_strings_buffer=131072 | ||
opcache.log_verbosity_level=2 | ||
opcache.enable_cli=1 | ||
--FILE-- | ||
<?php | ||
|
||
echo 'OK'; | ||
|
||
?> | ||
--EXPECTF-- | ||
%sWarning opcache.interned_strings_buffer must be less than or equal to 4095, 131072 given%s | ||
|
||
OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--TEST-- | ||
Bug GH-9259 002 (Setting opcache.interned_strings_buffer to a very high value leads to corruption of shm) | ||
--EXTENSIONS-- | ||
opcache | ||
--INI-- | ||
opcache.interned_strings_buffer=-1 | ||
opcache.log_verbosity_level=2 | ||
opcache.enable_cli=1 | ||
--FILE-- | ||
<?php | ||
|
||
echo 'OK'; | ||
|
||
?> | ||
--EXPECTF-- | ||
%sWarning opcache.interned_strings_buffer must be greater than or equal to 0, -1 given%s | ||
|
||
OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--TEST-- | ||
Bug GH-9259 003 (Setting opcache.interned_strings_buffer to a very high value leads to corruption of shm) | ||
--EXTENSIONS-- | ||
opcache | ||
--INI-- | ||
opcache.interned_strings_buffer=500 | ||
opcache.enable_cli=1 | ||
--FILE-- | ||
<?php | ||
|
||
echo 'OK'; | ||
|
||
?> | ||
--EXPECTF-- | ||
%sFatal Error Insufficient shared memory for interned strings buffer! (tried to allocate %d bytes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters