php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71574 Opcache corruption after using opcache_reset()
Submitted: 2016-02-12 09:13 UTC Modified: 2016-02-25 08:13 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:-1 (-100.0%)
From: ruudk at mphuis dot com Assigned: laruence (profile)
Status: Closed Package: opcache
PHP Version: 7.0.3 OS: Ubuntu 14.04.3 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 - 17 = ?
Subscribe to this entry?

 
 [2016-02-12 09:13 UTC] ruudk at mphuis dot com
Description:
------------
Sometimes, after running a deploy using Capistrano and clearing the Opcache using a curl request that executes opcache_reset() we get loads of 500 Internal Server errors. 

In our error log we see something like this:

[12-Feb-2016 08:45:31 UTC] PHP Fatal error:  Class 'CartBundle\Service\PaymentService���' not found in /company/releases/20160212084602/cache/prod/frontendProdProjectContainer.php on line 7805

It's never the same class that's missing, it's never the same server that has the problem. It occurs random.

The solution is always to execute the opcache_reset() again or to restart PHP FPM.


Some more errors:
[10-Feb-2016 15:33:10 UTC] PHP Fatal error:  Class 'Monolog\Handler\AbstractProcessingHandler���' not found in /company/releases/20160210153329/cache/prod/classes.php on line 1111

PHP Warning:  include(): Failed opening '/company/releases/20160209133021/vendor/richsage/rms-push-notifications-bundle/RMS/PushNotificationsBundle/RMSPushNotificationsBundle.php�php' for inclusion (include_path='.:/usr/share/php:') in 


This one is also remarkable, because you see lots of weird characters in the filename.

Feb 09 14:29:51 website-webserver-i-46b1b4cb php_errors.log: [09-Feb-2016 13:29:50 UTC] PHP Warning:  include(): Failed opening '/company/releases/20160209133021/vendor/richsage/rms-push-notifications-bundle/RMS/PushNotificationsBundle/RMSPushNotificationsBundle.php���(N{�k' for inclusion (include_path='.:/usr/share/php:') in 


So to me it appears to be a race condition that corrupts the opcache. We run 2 of 3 webservers behind a loadbalancer with a couple of hundred people online simultaneously. 


We use the following opcache settings (rest is standard):

[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1

; The OPcache shared memory storage size.
opcache.memory_consumption=192

; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=16

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
opcache.max_accelerated_files=32531

; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
opcache.revalidate_freq=1



It looks to be related to https://bugs.php.net/bug.php?id=70656 which is closed/solved.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-25 08:13 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2016-02-25 08:13 UTC] laruence@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2016-04-05 12:35 UTC] danny at myheritage dot com
We are having the same symptoms using php 7.0.5
We can reproduce it by calling opcache_reset while the server is on load.
Please let me know of any more info that I can provide to help troubleshooting this.

BTW - Couldn't find any commit related to this bug although it is marked as closed.
 [2017-01-12 03:58 UTC] 804368954 at qq dot com
We are having the same symptoms using php 7.0.6
 [2018-04-02 09:11 UTC] www dot maben at foxmail dot com
Has this bug been fixed?
 [2018-04-03 12:19 UTC] ruudk at mphuis dot com
Yes this is fixed but I cannot close the issue since I don't know the password and cannot reset it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC