Many instances of php-cgi.exe in Task Manager

Discussion in 'PHP' started by An3, Jul 13, 2010.

  1. #1
    Today my server came to a grinding halt. After waiting about 2 minutes for remote desktop to log in, I opened task manager (another 2 mins) and saw that there was about 40 instances of php-cgi.exe running.

    I've googled this and saw that people had the same problem, and recommendations was to switch from FastCGI to ISAPI. But I'm using Apache on Windows and don't want to switch to IIS.

    Any ideas what is causing this problem? It only started recently and the server is not really loaded.
     
    An3, Jul 13, 2010 IP
  2. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Had the same problem a few months ago.
    Tracked it down to a rogue wordpress plugin that was using the notorious psuedo-cron built into wordpress.

    wp_cron() in 'wp-includes\cron.php'
     
    Deacalion, Jul 13, 2010 IP
  3. An3

    An3 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Deacalion, thanks for the quick reply.

    I'm not using Wordpress. Do you think it can be some other plugin causing it?
     
    An3, Jul 13, 2010 IP
  4. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Wouldn't know without looking. Took my a while to figure that one out.
    This is why it happened with me anyway:
    1. User visits site, wordpress fires the psuedo cron
    2. The plugin added a cronjob to retrieve an xml feed
    3. The xml server was slow, so the cronjob took ages
    4. These cronjobs built up until php instances were everywhere

    Maybe there is something that takes quite a while to finish executing.
    They will eventually pile up until they crash. A messy database query perhaps?
     
    Deacalion, Jul 13, 2010 IP
  5. An3

    An3 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I understand your scenario, and we sometimes have long-running operations which generate PDF files from database information. But I mean, the processes are supposed to terminate at some point with a timeout or something, even if the query hangs, or will it just sit there forever? And why does these processes continue to run even when I stop Apache?
     
    An3, Jul 13, 2010 IP