« Previous Next »

Thread: The FastCGI process exited unexpectedly

Last post 11-13-2009 4:56 PM by ltu. 20 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (21 items) 1 2 Next >

Sort Posts:

  • 10-07-2009, 8:58 PM

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    The FastCGI process exited unexpectedly

    Yet another in a long line of users who are having issues running FastCGI under IIS6.

     I have been receiving this error intermittently during production use and paired with the fact that PHP is no longer going to support the ISAPI extension really gives me no choices. FastCGI has errors more than ISAPI does. I'd love to stick with the 5.2 branch of PHP, however reporting bugs result in them saying they are not going to fix it and I should use FastCGI.

    It is that same negative number error code that is all over this forum. I've tried both NTS and TS builds of 5.3 and all the 5.2.x versions, different snapshots that I've got multiple directories on my drive of, but I still get this darned error. Permissions are fine, the site works great under low load, but once it gets high, what appears to be 1,700 database queries a second (120 connections/s), it just randomly fails on me. It eventually comes back, but the error happens too often to be useful. I've tried 1,000 instance max requests and fcgi max requests of 1,100. Same problem. Changed the idle, activity and request to values in howto documents, no success. Help. For the love of dog, help.

     My fcgiext.ini

     [Types]
    php=PHP
    MaxInstances=300
    IdleTimeout=300
    ActivityTimeout=300
    RequestTimeout=300
    InstanceMaxRequests=10000
    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:15000
    QueueLength=2000

    [PHP]
    ExePath=c:\php\php-cgi.exe

     

    If this is a FastCGI bug, would someone explain to me how to debug on a x64 2003 Server? There is a link to Rick Jame's blog post or something, but that is for IIS7, which I find to be a mess of icons. If there is a Microsoft dev here who works on this and wants get on the server to debug, I'd be willing to give access to it for testing. This is really annoying me. I am very, very tired.

  • 10-08-2009, 4:40 AM In reply to

    • pierrejoye
    • Top 75 Contributor
    • Joined on 02-12-2009, 10:52 PM
    • Germany
    • Posts 73

    Re: The FastCGI process exited unexpectedly

    FastCGI is the recommended SAPI, by PHP.net and Microsoft.

     About your bug, it is hard to help without knowning what you do. Do you have a script to reproduce it? Or the function where it crashes?

    --
    Pierre

    http://blog.thepimp.net | http://windows.php.net
  • 10-08-2009, 4:58 AM In reply to

    Re: The FastCGI process exited unexpectedly

    Hi,

    I am not sure if your FastCGI is configured correctly. Are you getting this error for all the PHP pages. I mean even simple phpinfo() page is not working correctly. Please follow my blog post at http://blogs.iis.net/donraman/archive/2009/10/07/installing-php-on-windows.aspx and configure PHP accordingly. It will work for sure.

    Thanks,

    Don.

  • 10-08-2009, 11:55 AM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

     I am unable to reproduce it willingly. It just happens. In my error log it complains about __autoload() being nested too deeply and it seems to reload our autoload require over and over again causing that error to be logged. There is no single line of code that I could give you that returns a problem, if I had a line, then I wouldn't be here crying over the problems I've been having. All I have is a server which handles close to 4,000 connections at any given moment. This is running off one machine.

     FastCGI works great, until it just stops and starts exiting unexpectedly. I've accessed every page possible by a user and admin alike and it does not suddenly kick out an error to me. htmlentities complain about nonbyte characters or something and then randomly mysql real escape string errors show up because MySQL stopped responding to queries. I guess an active connection is required to MySQL to use that function.

    It complains autoload.php:2 about line 8 which is the } about it being nested too deep.

    2:  function __autoload($class)
    3:   {
    4:        if(strpos(strtolower($class),'exception') !== false)
    5:           require "exceptions/$class.exception.php";
    6:        else
    7:          require "classes/$class.class.php";
    8:    }

     

    *edit*

    Invalid multibyte sequence in argument for htmlentities

     

    *Edit again*

    http://go.microsoft.com/?linkid=9671294

    I ran and installed that. I set up my configuration manually based on how to information on this site.

  • 10-08-2009, 6:16 PM In reply to

    Re: The FastCGI process exited unexpectedly

    Hi,

    'Nesting level too deep' is an error which you get when a function is called recursively and is not able to exit. The reason you can have this might be because in your application you are having some kind of circular dependency in the way you are auto loading the classes. I mean if you have class 'A' which is trying to auto load class 'B' and vice-versa effectively running this function infinitely.

    I would suggest to have a print/echo statement in both 'if' as well as 'else' clause printing the name of the class getting auto loaded and find the culprit set of classes creating the circular dependency. Once you detect the loop try to break it.

    This is my best guess. Again this seems like an application error which you will need to debug and fix it yourself.

    Thanks,

    Don.

  • 10-08-2009, 6:48 PM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

    Thanks for your response. My application does not call __autoload more than once and there is no class a calling class b which calls class a scenario. I've accessed every page available to the administrators and users, the problem does not appear. Insert concurrent load to the server and the problem eventually pops up for short periods of time.

     I wish to stress this point: This problem only presents itself under heavy load. Sythetic traffic does not seem to get the problem to appear, possibly because it isn't simulated long enough, but real life does since it never ceases.

  • 10-08-2009, 7:32 PM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

    Just received the line again.

    [08-Oct-2009 22:03:30] PHP Fatal error:  Cannot redeclare __autoload() (previously declared in D:\site\autoload.php:2) in D:\site\autoload.php on line 8

    If I'm not mistaken, this means that it is loading autoload again on line 8 of autoload.php?

  • 10-08-2009, 7:58 PM In reply to

    Re: The FastCGI process exited unexpectedly

    Yes, that's correct. You can use some kind of condition to check if the file is already included just return. This can be achieved in multiple ways,

    • You can define a constant and each time file is included check if the constant is defined or not using 'defined' keyword. if it is not defined include else skip.
    • Another alternative can be using function_exists to check the existence of function.

    And I am sure there are other ways of doing it.

    Thanks,

    Don.

  • 10-13-2009, 5:40 PM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

    I am now throwing exceptions when a file isn't correctly loaded. Since adding code to do that, I have not received a single error complaining about a class not there. Not a single exception. Go figure.

    I am still getting the fastcgi process exited unexpectedly when putting the site through a normal http stress test. We load the same script over and over again simulating 500 concurrent users for 40K requests. The requests are successful, however, eventually FastCGI seems to just tell the people who are on the queue or tried to connect to a closing process that it has exited unexpectedly.

     Is there some list of PHP functions that may cause the whole FastCGI  process to be forced to exit?

  • 10-13-2009, 10:42 PM In reply to

    Re: The FastCGI process exited unexpectedly

    Hi,

    There is no fix set of functions which will make FastCGI quit. And if I am right, same request is working fine in normal load. It's only that on a stress environment FastCGI is exiting. Right? This means application is okay from functionality point of view. Can you tell me what version of FastCGI you are using and on what OS?

    Thanks,

    Don.

  • 10-13-2009, 11:09 PM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

    Correct. The FastCGI stuff works fine for a while, but once real load starts pouring in, it eventually starts giving me that error. Not ALL the time, but enough to get emails about it.

     

     7.5.7232.0 (fbl_srv_iis_dev(ksingla).090202-1706)

    Which should be the one linked in this thread: http://forums.iis.net/t/1158720.aspx


    Windows Server 2003 Enterprise X64 Service Pack 2

    Dual Quad cores at 2.33GHz

    20GB RAM

  • 10-14-2009, 12:38 AM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: The FastCGI process exited unexpectedly

    Problem is probably in PHP. Looks like php-cgi.exe is crashing under certain conditions. Is it possible to get a crash dump?

    Follow me on twitter at http://twitter.com/kjsingla
  • 10-14-2009, 1:38 AM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

    I've never been able to capture one so it isn't currently possible.

  • 10-25-2009, 1:15 AM In reply to

    • ltu
    • Top 500 Contributor
    • Joined on 07-01-2008, 6:23 PM
    • Posts 24

    Re: The FastCGI process exited unexpectedly

    Would you be able to explain, in depth or at least link me to a resouce, that will allow me to gain a dump for your analysis? It needs to work for 64bit PHP.

    The current PHP debug process does not cover this and only the 32 bit program way.

  • 10-27-2009, 4:16 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: The FastCGI process exited unexpectedly

    You can use either adplus or debugdiag to collect a dump easily. This article explains how to use adplus. DebugDiag and DebugDiag whitepaper can be downloaded from here. php.net has this article on how to generate the backtrace for PHP which will be useful to generate a stack trace.

    Follow me on twitter at http://twitter.com/kjsingla
Page 1 of 2 (21 items) 1 2 Next >
Microsoft Communities