Home » Php » codeigniter – PHP Fatal error: Failure in wincache (windows azure)

codeigniter – PHP Fatal error: Failure in wincache (windows azure)

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have codeigniter framework in my project. My website is running on windows azure platform. Sometimes it’s giving me this error:

PHP Fatal error: Failure in Wincache[6484] free_memory: Block 0x41d56d8 not in use
in D:\home\site\wwwroot\system\libraries\Log.php on line 44

I tried to change php.ini file by changing value of memory:

ini_set('memory_limit','2048M');

But, then after I checked memory_get_peak_usage(); then I found that application is not even using more than 1MB. I don’t know what’s going on here. I am getting blank page and website gets down when this happens.

Please, ask me if you need more information or code.

Log.php:

public function __construct()
{
    $config =& get_config();

    $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/';

    if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) // This is line 44.
    {
        $this->_enabled = FALSE;
    }

    if (is_numeric($config['log_threshold']))
    {
        $this->_threshold = $config['log_threshold'];
    }

    if ($config['log_date_format'] != '')
    {
        $this->_date_fmt = $config['log_date_format'];
    }
}

log.php file is default codeigniter file.

FINAL SOLUTION:

I have updated my php.ini file with this:

wincache.fcenabled=0
wincache.ocenabled=0
wincache.ucenabled=0
wincache.reroute_enabled = 0
wincache.srwlocks = 0
How to&Answers:

It’s an issue with IIS or WinCache on Windows Server. You can follow official thread on a iis forum.
Just to be sure, check following options in your php.ini:

wincache.reroute_enabled = 0
wincache.srwlocks = 0

Also update wincache to a latest version.

Answer:

The specific WinCache error message has been removed as of WinCache 1.3.7.5, which was pushed out in a recent Azure Web Services update.

As for the meaning of the error message: While attempting to free a block of memory in a cross-process shared memory segment, WinCache detected that the block had already been freed. The message indicates that WinCache detected the problem, and avoided corrupting memory. The message should really be a Warning level message. Further, the executing request should run to completion, and a response should be returned to the customer.

Prior to WinCache 1.3.7.4, WinCache did not detect this scenario, and would wind up corrupting memory, which would eventually lead to an AV. So, the error message actually indicates that WinCache just saved you from crashing, and you’re welcome!