Bug #75737 [Opn]: Opcache has corrupt method signatures after invalidation via files
| From: | stephan dot lueckl at niceshops dot com | Date: | Wed, 27 Dec 2017 12:53:01 +0000 |
| Subject: | Bug #75737 [Opn]: Opcache has corrupt method signatures after invalidation via files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213293@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75737&edit=1
ID: 75737
User updated by: stephan dot lueckl at niceshops dot com
Reported by: stephan dot lueckl at niceshops dot com
Summary: Opcache has corrupt method signatures after
invalidation via files
Status: Open
Type: Bug
Package: opcache
Operating System: Debian 8
PHP Version: 7.1.12
Block user comment: N
Private report: N
New Comment:
Problem did not occur in the versions 7.1.6, 7.1.8, 7.1.9
OPCache settings from phpinfo().
opcache.blacklist_filename no value no value
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli Off Off
opcache.enable_file_override On On
opcache.error_log no value no value
opcache.fast_shutdown 1 1
opcache.file_cache no value no value
opcache.file_cache_consistency_checks 1 1
opcache.file_cache_only 0 0
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.huge_code_pages Off Off
opcache.inherited_hack On On
opcache.interned_strings_buffer 6 6
opcache.lockfile_path /tmp /tmp
opcache.log_verbosity_level 0 0
opcache.max_accelerated_files 262237 262237
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 960 960
opcache.opt_debug_level 0 0
opcache.optimization_level 0xffffffff 0xffffffff
opcache.preferred_memory_model no value no value
opcache.protect_memory 0 0
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments 1 1
opcache.use_cwd On On
opcache.validate_permission Off Off
opcache.validate_root Off Off
opcache.validate_timestamps Off Off
Previous Comments:
------------------------------------------------------------------------
[2017-12-27 12:17:11] nikic@php.net
Can you please provide your opcache related ini configuration? Also, if you say it did not occur
prior to 7.1.9, do you mean that you are observing the problem in 7.1.9 but not 7.1.8, or that you
upgraded directly from 7.1.8 to 7.1.12 and seeing the problem now?
------------------------------------------------------------------------
[2017-12-27 12:12:51] stephan dot lueckl at niceshops dot com
Description:
------------
Some examples from the error log (error log is full with this):
1) PHP Fatal error: Uncaught TypeError: Argument 1 passed to ServiceDb_Session::__construct() must
be an instance of DB_Generated_ShopWAWIProduct, instance of ServiceDb_Connection given, called in
Factory.php on line 25 and defined in Session.php:41
2) PHP Fatal error: Uncaught TypeError: Argument 1 passed to ServiceDb_Session::__construct() must
be an instance of Smarty_Internal_Template, instance of ServiceDb_Connection given, called in
Factory.php on line 25 and defined in Session.php:41
3) PHP Fatal error: Uncaught TypeError: Argument 1 passed to ServiceDb_Session::__construct() must
be an instance of ServiceDb_Connection, instance of ServiceDb_Connection given, called in
Factory.php on line 25 and defined in Session.php:41
The session classes are part of an overwritten session handler, that implements the
SessionHandlerInterface.
You can see - the method signature of the class somehow is corrupted (interesting in example 3:
expectation and actual value is equal)
This happens after we reinvalidate the opcache via files (reinvalidation script below) - within the
reinvalidation this type of session with the overwritten sessionhandler is started.
At the moment this problem only occurs within this session classes.
As this happens once - all requests to the server are having this error (the overwritten session
system is used in every case).
Problem can be fixed by calling opcache_reset();
This problem did not occur prior to PHP 7.1.9
Test script:
---------------
Method Signature
class ServiceDb_Connection
{
/**
* @var ServiceDb_Connection
*/
private $connection;
public function __construct(ServiceDb_Connection $connection)
{
$this->connection = $connection;
}
}
Opcache Invalidation Script (invalidates the cache from the project base root):
$opStatus = opcache_get_status(true);
if (is_array($opStatus["scripts"])) {
foreach ($opStatus["scripts"] as $file => $info) {
if (strpos($file,BASE_ROOT) === 0) {
opcache_invalidate($file);
}
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75737&edit=1