Weird behavior related to the use of wincache+__autoload magic methodRSS

6 replies

Last post Jan 23, 2010 11:59 PM by don.raman

  • Weird behavior related to the use of wincache+__autoload magic method

    Jan 07, 2010 06:59 AM|moleruski|LINK

    I´ve noticed a really weird behaviour on my production server:

    Everything works fine with wincache, but every once in a while, my scripts quit calling the __autoload method.

    Example script:

    include_once("autoload.php");

    $myClass=new MyClass;

     

    This works ok (the problem has nothing to do with the __autoload function included in the autoload.php file (it worked for years in our previous  production server), but then suddenly we get a Fatal Error 'Class not found'.

    It happens with every script i execute, and the class not found is always the first class declared in the script.

    I´ve tested it, and the problem is the __autoload magic function won´t get called.

    If i programatically call the function, the script works ok.

    Example:

    include_once("autoload.php");

    __autoload("MyClass");

    $myClass=new MyClass;

     

    I know for sure the problem is related to wincache, because i can see in the stats page (wincache stats page) that there are 1700 BILLIONS of files cached, which is totally imposible. If i manually kill the php-cgi processes (we have at most 4 php-cgi processes, running under fastcgi, and created by one single worker process), then the wincache gets rebooted, and our apps start working again.

    Sorry for such a long post, any help would be really appreciated.

    Thanks a lot.

  • Re: Weird behavior related to the use of wincache+__autoload magic method

    Jan 07, 2010 07:49 AM|don.raman|LINK

    Thank you for reporting this to us. Can we get a small PHP code which we can use to reproduce the bug at our side on a consistent basis? This will help us debugging the code and fixing it.

    From mere description it seems like auto-loading is going to some kind of infinite loop. You can do two things, either please provide a small code which we can use in-house or get us access to a machine which exhibits this problem. We are working on a refresh to WINCACHE 1.0 and would like to fix it.

    Again thanks for reporting it to us.

    Don.

  • Re: Weird behavior related to the use of wincache+__autoload magic method

    Jan 08, 2010 02:31 AM|moleruski|LINK

    I´m sending you the content of 2 files where we can see the problem, but the thing is, i dont think you will reproduce it, and i don´t think i can find a way to let you access our production server...

    This is the code for the files autoload.php and test.php

    --------------------------------------

    autoload.php

    --------------------------------------

    define("CLASS_DIR", "C:\Inetpub\wwwroot\classes\");

    function __autoload($className)

    {

    require_once(CLASS_DIR.$className.".php");return;

    }

    --------------------------------------

    test.php

    --------------------------------------

    include_once (dirname(__FILE__) . "/../clases/autoloadClasses.php");

    $tbd=new TBD;

     

    The thing is: this really simple code has been working for years in our previous production server (still in use, until we fix this problem and move on to the new one), i´m sure there´s no infinite loop, besides that, this code might be working for several days while we test our new server, and it suddenly quits working, for every application in our server, the error message would be: Fatal Error, class "NameOfTheFirstClassInTheFile" not found.

    I´ve noticed the problem is that the magic __autoload function won´t get called anymore (i´ve tried throwing exceptions from the __autoload function, and the exception never get´s thrown), if i manually call that function before i instantiate the tbd object, that would work:

    include_once (dirname(__FILE__) . "/../clases/autoloadClasses.php");

    __autoload("TBD"); 

    $tbd=new TBD;

     

    I´m sorry i can´t give you no more clues, i think it´s gonna be hard to fix, but we´d appreciate any help.

    Thanks a lot.

  • Re: Weird behavior related to the use of wincache+__autoload magic method

    Jan 12, 2010 02:49 AM|moleruski|LINK

    Hello, did you reproduce the problem?

    I´m sorry I can´t let you access our production server (company rules), but i can tell you what kind of server, ddbb, operating system... we have, since you might have a similar machine where you could try this code, although i don´t know if it will reproduce either...

    Thanks.

  • Re: Weird behavior related to the use of wincache+__autoload magic method

    Jan 12, 2010 09:02 AM|don.raman|LINK

    Hi,

    We are trying to fix similar crash. There is a bug where shared memory is not being locked properly and is getting corrupted. Once the shared memory gets corrupted behavior is undefined. You might be facing a similar situation. We are working on a fix. Once we have the fix I will send you the private DLL so that you can verify it at your end.

    Thanks,

    Don.

  • Re: Weird behavior related to the use of wincache+__autoload magic method

    Jan 19, 2010 03:06 AM|ksingla|LINK

    Hi,

    We have fixed a bug which was causing the crash. Is it possible for you to try a private to see if this bug is fixed? If yes, pls email me at ksingla at microsoft dot com and I will send you the private. Let me know if you need the private for php 5.2 or 5.3.

    Thanks.
    Kanwal

  • Re: Weird behavior related to the use of wincache+__autoload magic method

    Jan 23, 2010 11:59 PM|don.raman|LINK

    Hi Moleruski,

    A gentle reminder if you haven't done this already. I remember you reporting a problem with inclusion of file with WINCACHE. We believe we have a solution for that. We are in the process of releasing WINCACHE 1.0.1 version with this fix. It will be good if you can test the private version of WINCACHE with the fix. This will be a win-win situation for both of us as you will get a chance to ensure that the fix is indeed working for you and if not we can address your concern too so that you can run WINCACHE smoothly. For us, it will be great to have a real customer validation. We have already got it validated by few customers. it would be great if you can help us in making WINCACHE a great caching solution on WINDOWS.

    For getting the privates, please mail me at DONRAMAN[@]MICROSOFT[dot]COM and let me know if you need the privates for PHP 5.2 or PHP 5.3.

    Again thanks in advance for helping us.

    Regards,

    Don.