开发者

Temp-Files in Symfony-Cache folder

I'm using Windows on some production machines (IIS with FastCGI-PHP). Since the update of one SF-Project to 1.3.x I notice some strange problems. The Server is "collecting" Temp-Files in the config-cache folder of the applications. They are named like c开发者_StackOverflowon1718.tmp and always containing the autoload-config-cache. The tmp-files are not generated for every request but I have 1 or 2 new files every half an hour or so. If the application is running some days/months there are a lot of these Temp-Files (Megabytes of them).

Machine-Details: - Windows Server 2008 - IIS 7 - ZendServer? with PHP 5.2.11

Project with SF 1.3.3

Any ideas what the problem can be?


I checked out symfony 1.4 and saw this in the code:

     // Hack from Agavi (http://trac.agavi.org/changeset/3979)
     // With php < 5.2.6 on win32, renaming to an already existing file doesn't work, but copy does,
     // so we simply assume that when rename() fails that we are on win32 and try to use copy()
     if (!@rename($tmpFile, $cache))
     {
       if (copy($tmpFile, $cache))
       {
         unlink($tmpFile);
       }

     }

This piece of code should be in sfConfigCache.php on line 354, could you check you have this lines? If not, consider updating, or patching, and if yes, you could log $tmpFile before unlinking it, just to see if there is an attempt to unlink these files or not. To add more information log, you should try this code instead:

 if (!@rename($tmpFile, $cache))
 {
   sfContext::getInstance()->getLogger()->info('attempt to renaming ' . $tmpFile . ' failed, trying copy');
   if (copy($tmpFile, $cache))
   {
     sfContext::getInstance()->getLogger()->info('copy successful, now unlinking ' . $tmpFile);
     unlink($tmpFile);
   }
   else
   {
     sfContext::getInstance()->getLogger()->err('probem with copy for file '.$tmpFile);
   }

 }


'con1718.tmp' looks like a temporary file name generated with tempnam PHP function:

tempnam('c:/tmp', 'con'); // produces something like c:\\tmp\con1234.tmp

I used grep on symfony sources to find such calls but didn't find any tempnam() usage with 'con'. Maybe it's one of the plugins you're using?


Any chance you're running the Windows Cache Extension for PHP (Windows Cache Extension 1.1 for PHP 5.2 in Web Platform Installer 2.0)? I've noticed that while this package tries to ape the behaviour of APC PHP Accelerator that is widely used, it does consume a lot of resources and do some odd things, especially file writes in odd places. I've yet to mash symfony and it together, but will be doing so in the next few weeks. Otherwise, my specs match yours quite closely.

Not a full answer maybe, but if it is installed, how about disabling it and retrying?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜