Current time: 11-25-2024, 07:31 PM Hello There, Guest! (LoginRegister)


Post Reply 
Long time execution -exit(idle timeout), terminated by calling exit(), return code: 0
Author Message
circut_breaker Offline
Junior Member
*

Posts: 11
Joined: Feb 2010
Reputation: 0
Post: #16
RE: Long time execution -exit(idle timeout), terminated by calling exit(), return code: 0
Welcome,

Sorry for late reply but i was sick.

Finally i use shell_exec, that error about what i talk previous was created by print($output); command... I just deleted printing because i don't need it...


So i will start from beginning.

After installing pcntl, putting application into threads everything was working great about half month 24/24. Application was starting by cron, every minute using following code.
Code:
* * * * *  /usr/bin/wget --delete-after "http://xxx.xxx/xxx.php" >/dev/null 2>&1

* * * * *  /usr/bin/wget --delete-after "http://xxx.xxx/xxxy.php" >/dev/null 2>&1

As i said, everything work smooth half month...

About 4 days back, i got emergency call.... server goes down...
They take me out from bed and put in front of server...

I was trying connect via ssh but she didn't respond me... i can't access apache, webmin... anything...

I had cut power off.

After restart, everything work great...
I run some tests, check disks, look at memory, make all updates, everything look ok so i left server alone.

After 24 hours i get same call...

Force reboot, and from 2 days i'm looking at logs, everything and found where error is...

Application started by pcntl process don't close correctly... and create zombie process

Code:
    1646    vu2xxx    10:07    [php5-cgi] <defunct>
               1656    vu2xxx    10:08    [php5-cgi] <defunct>
               1676    vu2xxx    10:09    [php5-cgi] <defunct>
               1689    vu2xxx    10:10    [php5-cgi] <defunct>
               1699    vu2xxx    10:11    [php5-cgi] <defunct>
               1710    vu2xxx    10:12    [php5-cgi] <defunct>
               1720    vu2xxx    10:13    [php5-cgi] <defunct>
               1730    vu2xxx    10:14    [php5-cgi] <defunct>
               1744    vu2xxx    10:15    [php5-cgi] <defunct>
               1757    vu2xxx    10:16    [php5-cgi] <defunct>
               1767    vu2xxx    10:17    [php5-cgi] <defunct>
               1777    vu2xxx    10:18    [php5-cgi] <defunct>
               1788    vu2xxx    10:19    [php5-cgi] <defunct>
               1803    vu2xxx    10:20    [php5-cgi] <defunct>
               1821    vu2xxx    10:21    [php5-cgi] <defunct>
               1832    vu2xxx    10:22    [php5-cgi] <defunct>
               1842    vu2xxx    10:23    [php5-cgi] <defunct>
               1856    vu2xxx    10:24    [php5-cgi] <defunct>
               1867    vu2xxx    10:25    [php5-cgi] <defunct>
               1877    vu2xxx    10:26    [php5-cgi] <defunct>

vu2xxx represent user who use pcntl threads.

After 12 hours it create 800 process.

I check date of sources, and no modifications was made in that half month... i don't know why it stops working.
Right now i have every 12hours reboot server !



This is code of application:
( i remove code and put comments )
Code:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/


function download_xxx() {
    function shutdown() {
        posix_kill(posix_getpid(), SIGHUP);
    }

    // Go to background
    $pid = pcntl_fork(); // fork
    if ($pid < 0) return false; // Unable to fork
    else if ($pid) return true;
    else {
         // child, but not detached from the main process yet. Cleanup things
        ob_end_clean(); // Discard the output buffer and close
        fclose(STDIN);  // Close all of the standard
        fclose(STDOUT); // file descriptors as we
        fclose(STDERR); // will be running in background.
        register_shutdown_function('shutdown');
        // Try to become master
        if (posix_setsid() < 0) exit(1);
        // And do the final fork out of apache/fastcgi control
        if (pcntl_fork()) exit(0);

        // Perform your long running task. You *must* reopen any db connection,
        // as it will have been closed by the first child.

      
//start mysql code
//here i START mysl connection


//Here i call mysql select


//Here  i download file...

//Here i save file

//Here i call mysql and put information about downloaded file


//Here i disconnect mysql
  

        // Exit cleanly when the task has been completed.
        exit();
    }
}
download_xxx();
exit();
?>




I really don't know what's going wrong.
It's really working half month... every single minute starting 2 process.... right now i't don't close thread...


Please help
03-19-2010 07:38 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Long time execution -exit(idle timeout), terminated by calling exit(), return code: 0 - circut_breaker - 03-19-2010 07:38 PM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)