php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72112 Opcache corruption after opcache_reset()
Submitted: 2016-04-27 09:40 UTC Modified: 2016-05-15 04:22 UTC
Votes:21
Avg. Score:4.5 ± 0.8
Reproduced:20 of 20 (100.0%)
Same Version:4 (20.0%)
Same OS:4 (20.0%)
From: thomas dot colomb at dailymotion dot com Assigned: laruence (profile)
Status: No Feedback Package: opcache
PHP Version: 7.0.5 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2016-04-27 09:40 UTC] thomas dot colomb at dailymotion dot com
Description:
------------
After calling opcache_reset() function we encounter some weird errors. It happens randomly on servers (10 of 400 servers production)

Some letter a replaced by others, Class seems to be already declared.. etc

Example of errors triggered after opcache_reset():

* Unknown column 'saken' in 'field list' => in this example t is replaced by s in the sql query. This can be really a big problem if in example on an update query a w of where is replaced by a ; and this will update whole table

* PHP Fatal error:  Cannot declare class ZZZZZ, because the name is already in use in /dir/dir/z.php on line 0

* PHP Fatal error:  Class XXX contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (YYY::funczzz) in /dir/dir/x.php on line 20

* PHP Fatal error:  Uncaught Error: Call to undefined method XXX::func1() in /dir/dir/x.php:218

It seems related to #71574 but it's still not corrected.

php -v
PHP 7.0.5-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

x@server:~# lsb_release --id
Distributor ID:	Ubuntu
x@server:~# lsb_release -r
Release:	14.04


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-27 09:51 UTC] thomas dot colomb at dailymotion dot com
opcache ini configuration :

opcache.enable=1
opcache.memory_consumption=512
opcache.max_accelerated_files=7000
opcache.enable_cli=1
opcache.interned_strings_buffer=8
 [2016-05-06 10:06 UTC] laruence@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: laruence
 [2016-05-06 10:06 UTC] laruence@php.net
it will be great if you could find a way to reproduce it...

otherwise, I can't do much things here to help :<

sorry & thanks
 [2016-05-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2017-06-28 13:04 UTC] shpr at libero dot it
I can confirm the bug, in my case I have a lot of intermittent errors:

Class Doctrine\\DBAL\\Driver\\PDOStatement contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Doctrine\\DBAL\\Driver\\Statement::errorInfo, Doctrine\\DBAL\\Driver\\ResultStatement::closeCursor) in /opt/db/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 28

My environment Debian Jessie + Apache 2.4.10 + Php 7 with and without opcache.

I dont'know how to reproduce the bug but I think is apache 2.4.x & PHP 7.x related. No problem with php 5.6 (never tried with other web servers). There are a lot of similar tickets in the web, for example: 

https://stackoverflow.com/questions/42503240/intermittent-php-abstract-class-error

https://community.apachefriends.org/viewtopic.php?p=250966&sid=96ef58aaeb7fe142a7dcdfd506a8683f

https://stackoverflow.com/questions/36088683/php-7-symfony-3-fatal-error-1-abstract-method-and-must-therefore-be-declared-a

Can I help the php team in some way? How can I provide more logs?

Thanks
 [2017-06-30 15:42 UTC] hescolar at bitban dot com
We are experiencing the same issue, using PHP-FPM 7.1.5 and nginx.
 [2017-07-23 21:59 UTC] cedric at nyrodev dot com
Same here with nginx and php-fpm PHP 7.0.20-1~dotdeb+8.2 after the sever have been running correctly for a while, it started doing it randomly on many pages, in a Symfony project. 
I disabled opcache for now. 

Here is my specific opcache configuration 
opcache.enable = 1
opcache.enable_cli = 0
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 8
opcache.revalidate_freq = 60
opcache.max_accelerated_files = 8000
opcache.fast_shutdown = 1

The server is not very busy as it's an internal backoffice used by 50+ people only. 
There is a lot of cron task running in cli. 

Hope it will help.
 [2017-12-15 10:40 UTC] robsonpiere at outlook dot com
We had the same problem using codeignaiter and PHP 7.1.X

I upgraded to php 7.2 and the problem did not occur anymore.


Note: I'm sorry for my level of English, I hope I have helped
 [2018-09-03 20:19 UTC] mah at everybody dot org
https://stackoverflow.com/a/48250183

The above SO answer suggests that this can be fixed by putting
  opcache.use_cwd=1
in the php.ini
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 01:01:30 2024 UTC