litespeedtech/openlitespeed

Crashes the php execution process when resetting the opcache

Closed this issue · 3 comments

Hi
I have a long php process (doc) :

<?php
ignore_user_abort(true);
set_time_limit(0);
ob_implicit_flush();
header('connection: close');
$i = 0;
while(true)
{
    if($i % 1200 === 0)
    {
        ///... include some files
    }
    file_put_contents('test.txt', $i);
    $i++;
    sleep(1);
}

After running this script, it works for a long time without any problem.
When I reset the "opcache" with the following codes, the above script is killed after a few minutes(usually 200 second).

<?php
opcache_reset();
clearstatcache();

@ziaratban but what strange?

opcache contains precompiled php scripts, include your php script.

There is nothing strange.
In the opcache_reset function, I think this should be managed in such a way that it does not affect the running processes.

I think this is related to php core. it's true?

@ziaratban

  1. this no OLS issue. this is opcache work algorithm.
  2. if you clear php cache then always affect to all running php processes because these php processes started from cache.
  3. if you have access to opcache settings then you can exclude some php scripts from caching