Bug #71574 [Com]: Opcache corruption after using opcache_reset()

From: Date: Tue, 03 Apr 2018 12:19:43 +0000
Subject: Bug #71574 [Com]: Opcache corruption after using opcache_reset()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214578@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71574&edit=1

 ID:                 71574
 Comment by:         ruudk at mphuis dot com
 Reported by:        ruudk at mphuis dot com
 Summary:            Opcache corruption after using opcache_reset()
 Status:             Closed
 Type:               Bug
 Package:            opcache
 Operating System:   Ubuntu 14.04.3 LTS
 PHP Version:        7.0.3
 Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

Yes this is fixed but I cannot close the issue since I don't know the password and cannot reset
it.


Previous Comments:
------------------------------------------------------------------------
[2018-04-02 09:11:54] www dot maben at foxmail dot com

Has this bug been fixed?

------------------------------------------------------------------------
[2017-01-12 03:58:44] 804368954 at qq dot com

We are having the same symptoms using php 7.0.6

------------------------------------------------------------------------
[2016-04-05 12:35:34] 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.

------------------------------------------------------------------------
[2016-02-25 08:13:37] 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-02-12 09:13:55] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71574&edit=1


Thread (6 messages)

« previous php.bugs (#214578) next »