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

From: Date: Fri, 12 Feb 2016 09:13:59 +0000
Subject: Bug #71574 [NEW]: Opcache corruption after using opcache_reset()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199173@lists.php.net to get a copy of this message
From:             ruudk at mphuis dot com
Operating system: Ubuntu 14.04.3 LTS
PHP version:      7.0.3
Package:          opcache
Bug Type:         Bug
Bug description:Opcache corruption after using opcache_reset()

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 bug report at https://bugs.php.net/bug.php?id=71574&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71574&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71574&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71574&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71574&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71574&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71574&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71574&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71574&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71574&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71574&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71574&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71574&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71574&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71574&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71574&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71574&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71574&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71574&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71574&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71574&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#199173) next »