zendtech / ZendOptimizerPlus

Other
915 stars 142 forks source link

April 28th commit causes segfault when opcache_invalidate used #93

Closed ck-on closed 11 years ago

ck-on commented 11 years ago

The new invalidate function has been working great (thanks!) until one of the commits on April 28th

Consistently causes this now:

kernel: php-fpm[13804]: segfault at 0 ip 00007fdf431b2dca sp 00007fff8ad32b60 error 4 in opcache.so[7fdf431a8000+21000]

php-fpm 5.4.16-dev on 64bit centos 6.4

Will try to figure out how to roll back a commit or two, to see which one it is...

added:

okay this commit breaks it, I think "Avoid possible conditional jump depended on uninitialised value" https://github.com/zend-dev/ZendOptimizerPlus/commit/95b1b4e06c539631707d7c05490f1e648f302512

I was able to use the previous commit without any problems with invalidate

laruence commented 11 years ago

Is there a reproduceable script?

laruence commented 11 years ago

and, what's the backtrace is?

ck-on commented 11 years ago

@laruence Sorry, unfortunately I do not know how to do a backtrace? Are you saying php-fpm should have shown one with the segfault?

The script was my control panel: https://gist.github.com/ck-on/4959032 Simply triggering "recheck" (with an updated file elsewhere) was enough to cause the segfault and the invalidate never happened.

Basically I run the server with a very high revalidate_freq to disable file stat and manually trigger invalidate when scripts are (rarely) updated. Until this commit, the process worked perfectly.

laruence commented 11 years ago

see here how to generate a backtrace: http://bugs.php.net/bugs-generating-backtrace.php

since I can not see a reason for that change cause the segfault for now, so a backtrace could be useful

thanks

Majkl578 commented 11 years ago

It doesn't crash for me on PHP 5.5.0-dev fpm-fcgi Linux, built on May 2 2013 04:19:33 CEST.

ck-on commented 11 years ago

Will recompile and test again tonight (12+ hours from now). Sorry I cannot do it sooner, other obligations.

ck-on commented 11 years ago

I apologize as I am unable to reproduce the problem now despite recompiling the master.

I have no idea why I was able to repeatedly trigger it the other night.

If I see it again I will attempt to document and debug it more carefully.

laruence commented 11 years ago

okey, then close now, you can re-open this if you encounter this issue again.

ck-on commented 11 years ago

I just encountered the segfault problem again with invalidate.

Something I just realized is it might be happening when the cache is in state of very little memory free, there was only 10M available (out of 128M) so maybe it was not able to allocate the memory needed?

But that would imply the memory tracking is inaccurate? There was no "cache full" count triggered.

Perhaps the little free memory left was so fragmented that it could not allocate a block big enough for updating the invalidated script. That might explain it?

Resetting the cache (while keeping it still running) immediately returned everything to normal.

laruence commented 11 years ago

could you please try to get a backtrace of that segfault? that will be easy for us to track it down