opcache issue on Moodle 3.4 and PHP 7.0.x

opcache issue on Moodle 3.4 and PHP 7.0.x

by William Chan -
Number of replies: 7

Dear All,

We upgraded Moodle system from 3.3 to 3.4 last month.

We also upgrade PHP from 5.6.x to 7.0.29 version and MySQL to 5.7.x version.

Opcache function is also enabled in PHP to improve peformance.

After new semester started, I find Moodle system is loaded improperly.

Last week, it show "system error and cannot open <<moodle root>> file...."

Today , it show "programming error and please inform admin to fix it...."

I just stop apache web server and startup again to resume service.

it worked for one week.

It seems it is relevant to the opcache cannot load the file to cache properly.


now opcache setting in php.ini is as the following.

zend_extension=/usr/local/lib/php/extensions/no-debug-zts-20151012/opcache.so

opcache.enable = 1
opcache.memory_consumption=128
opcache.max_accelerated_files=8000
opcache.revalidate_freq=60
 opcache.fast_shutdown=0
opcache.use_cwd = 1
opcache.enable_cli=0
opcache.validate_timestamps = 1
opcache.save_comments = 1


Please advise what the problem is .


Regards,

William






Average of ratings: -
In reply to William Chan

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by Ken Task -
Picture of Particularly helpful Moodlers

Not sure anyone could offer suggestions with information provided ...

"Last week, it show "system error and cannot open <<moodle root>> file...."

Today , it show "programming error and please inform admin to fix it...."

Those should have prompted turning on debugging to see specifics.

Ok, true, opcache comes with higher versions of PHP, and while you've shared your current (default) setup of opcache, not all systems are the same.   Bout the only thing one can gather from what you've shared so far is that it's a Linux server .. but that's it.

And you suspect opcache because it's new to your server setup?

Suggest that any upgrade to Moodle and it's settings could also play a role/part in issues/troubles your server might be experiencing now.

To get a better look at just php-opache, suggest installing one of the opcache scripts shown/shared via the following link:

https://www.stevejenkins.com/blog/2014/07/my-favorite-zend-opcache-status-scripts/

Other things?   How's DB performing?   Cron job and task running ok?   Are you running automated backups .... how is that performing?

'spirit of sharing', Ken



In reply to Ken Task

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by William Chan -

Dear Ken,


Thank for your info.

After reading below info link, I suspect it is relevant to php cache itself.

http://james-moodle.blogspot.com/2018/03/

https://moodle.org/mod/forum/discuss.php?d=240739

Indeed, the problem is encounter during office office.

No backup job is running, DB is running properly.

Moodle is worked after restart the web server.


Regards,

William


In reply to William Chan

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by Ken Task -
Picture of Particularly helpful Moodlers

Hmmmm ...

the blog link provided

http://james-moodle.blogspot.com/2018/03/

said this:

"Also.  If you see this error and you cannot access the moodle site admin - then option two is to empty a related folder in the moodledata area.  I double check this too and was able to browse the moodledata drive on my server and found the folder in question.

:Didn't get the same error but somthing similar ... don't re-call what it was now, but ... took a different approach and solved the problem.  The approach if you have command line access to /moodledata folder.  Manually remove the cache folder and it's contents.  I re-created an empty cache folder with ownerships/permissions for apache."

(uhhhhh ... hmmmm .... I wrote that!)

If I ever need to do this, I would first try just dumping but leaving the cache folder.."

which quoted as well as pointed to ...

https://moodle.org/mod/forum/discuss.php?d=240739#p1045240

Had you shared debug info ... probably would have concluded the same thing as was concluded back in 2013!

All is well that ends well, however! smile

'spirit of sharing', Ken


In reply to William Chan

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi William,
I do not know right now how to help you in solving your issue since we should have the actual PHP stack trace for each of your errors but I'd like to add a general note here.
Moodle cache (aka MUC) and opcache are not the same thing, even if MUC can use opcache.

One of PHP opcache roles is caching the code which is actually a big boost but with some issues in some contexts: MDLSITE-5251.

Could you enable Moodle debugging and provide here more details about your errors?
The more the better wink.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by Ken Task -
Picture of Particularly helpful Moodlers

+20 ... debug .. the higher the better! smile

'spirit of sharing', Ken

In reply to Ken Task

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by William Chan -

Dear ,

Now I write the php script to run "opcache_reset" daily.

However, it have different error after i run the script occassionally.

it is solved until I restart apache server.

moodle system environment

OS : redhet 6

PHP: 7.0.29

apache 2.4.26

Moodle 3.4.3

Indeed it seem relevant to PHP opcache issues.

/usr/local/lib/php/extensions/no-debug-zts-20151012/opcache.so

opcache.enable = 1
opcache.memory_consumption=256
opcache.max_accelerated_files=18000
opcache.revalidate_freq=60
 opcache.fast_shutdown=0
opcache.use_cwd = 1
opcache.enable_cli=0
opcache.validate_timestamps = 1
opcache.save_comments = 1


Please advise how to solve it.

I need solve it ASAP.

William



In reply to William Chan

Re: opcache issue on Moodle 3.4 and PHP 7.0.x

by William Chan -

Dear Sir,


Does it be solved if I upgrade php to 7.1 or 7.2 version?

If yes, does Moodle support 7.1 or 7.2 also?


Regards,

William