Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php script restarts randomly with same POST data

    I have a php script that receives parsed data from a javascript application via xmlhttp.

    I'm finding that the php script will sometimes stop while it's processing a chunk of data and restart with the same POST data that was sent to it. I thought that maybe the javascript's xmlhttp might be double firing somehow, but I've ruled that out with an inProgress flag as shown below:

    Code:
    function SendPHP(str, callback){
        xmlhttp = new XMLHttpRequest();  
        str = "q=" + encodeURIComponent(str);   
        xmlhttp.open("POST","sendmail.php", true);
        xmlhttp.onreadystatechange=function(){
            if (xmlhttp.readyState == 4){
                inProgress=false;
                if(xmlhttp.status == 200){
                                callback(xmlhttp.responseText);
                }
            }
        };
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    
            if (inProgress==false){
              inProgress=true;
            xmlhttp.send(str);
            }
            else{
                writeDisplayConsole("ERROR: xmlhttp fired twice!");
            }
    }
    If the xmlhttp tries to send twice then that error is shown and no further packets will be sent. But that's never the case so the php script must be restarting on it's own.

    Bear in mind that it happens at random intervals regardless if the data is the same. What could be causing this to happen?

    The php script frequently writes to big text file logs, could that be something to do with it?

    Here's the php (but since the error happens at random intervals with the same data, I'm not sure how it could be a problem with the php code):

    PHP Code:

    <?php

    writelog
    ("\n*** Sendmail script started ***");

    $q $_POST['q'];


       
    //Split auth code and verify
         
    $pieces explode("(<!asplit!>)"$q);
         
    $authc=$pieces[0];
         
    $q=$pieces[1];

         if (
    $authc<>"****"){
                echo 
    "!Authentification denied.";
                
    writelog ("Authentification denied");
                die;
         }

             
    writelog ("Authentification accepted");




         
    //Split off packet details
         
    $pieces=explode("(<!psplit!>)"$q);
         
    $tpack=$pieces[0];
         
    $q=$pieces[1];

         
    $pieces=explode("-"$tpack);
         
    $tpacket=$pieces[0];
         
    $ofpacket=$pieces[1];
         
    $totalcontacts=$pieces[2]; 

         
    //Split contact data from email message
         
    $pieces explode("(<!dsplit!>)"$q);
         
    $split=$pieces[0];
         
    $q=$pieces[1];

         
    //Assign contacts to array
         
    $contacts explode ("<!"$split);
         
    $tcount=count($contacts);
         
    $tcount=$tcount-1;

         echo 
    "(PACKET ";
         echo 
    $tpacket;
         echo 
    " OF ";
         echo 
    $ofpacket;
         echo 
    ")- ";

         
    writelog("(PACKET " $tpacket " of " $ofpacket ")");

             
    //Killswitch check incase double run
         
    checkKillSwitch("!Startup aborted as Power set to off.",0);
         
    checkKillSwitch("!Aborted, Killswitch set to Kill",1);
         
    file_put_contents('log/killswitch.txt'"on");

         echo 
    $tcount;
         echo 
    " contacts processing...";

         foreach (
    $contacts as &$value) {

         
    //check killswitch
         
    checkKillSwitch("Killswitch aborted during runtime",1);

                         
    $split=explode ("^!"$value);

                
    //Get the contact's details
             
    $firstname$split[0];
             
    $lastname$split[1];
                     
    $temail $split[2];

                     if (
    $firstname<>""){

               
    $mainmessage=str_replace("[firstname]",$firstname,$q);
                 
    $mainmessage=str_replace("[lastname]",$lastname,$mainmessage);


               
    //Split off subject
                 
    $pieces explode("(/subject)"$mainmessage);
                 
    $tsubject=$pieces[0];
                 
    $mainmessage=$pieces[1];

                        
    testLogMail($temail$tsubject$mainmessage);

                    
    //log progress      
                    
    $adder=$adder+1;

                        
    //For the log, show progress of total (based on 10 per packet change if different)
                        
    $tadder = (($tpacket-1)*10)+$adder;

                        echo (
    $tadder ".");

                        
    writelog($tadder " of " $totalcontacts " processed >> " $temail);
                        
    sleep(rand(2,20));

                    }   

         }

    function 
    testLogMail($xaddress$xsubject$xmessage){

      
    $tdate=date('d/m/Y H:i:s');

      
    $file 'log/testmaillog.txt';
      
    // Open the file to get existing content
      
    $current file_get_contents($file);

        
    // Enter email
        
    $towrite="To: ".$xaddress."\n";
        
    $towrite.="Subject: ".$xsubject."\n";
        
    $towrite.="Date: ".$tdate."\n";
        
    $towrite.="...\n";
      
    $towrite.=$xmessage."\n";
        
    $towrite.="___________________________________\n\n";

        
    $current .= $towrite;

      
    // Write the contents back to the file
      
    file_put_contents($file$current);

    }

     function 
    writelog($towrite)
    {
      
    $tdate=date('d/m/Y H:i:s');

      
    $file 'log/testlog.txt';
      
    // Open the file to get existing content
      
    $current file_get_contents($file);
      
    // Append a new person to the file
      
    $current .= $towrite." --- ".$tdate."\n";
      
    // Write the contents back to the file
      
    file_put_contents($file$current);


    function 
    checkKillSwitch($towrite$killtype){

    if (
    $killtype==0){
       
    $killswitch file_get_contents('log/killswitch.txt');

       if (
    $killswitch=="on") {
        echo 
    $towrite;
        
    writelog($towrite);
        die;
       }
     }

     if (
    $killtype==1){
       
    $killswitch file_get_contents('log/killswitch.txt');

       if (
    $killswitch=="kill") {
        echo 
    $towrite;
        
    writelog($towrite);
        die;
       }
     }


    }

    writelog("*** Sendmail script ended ***");
    ?>

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Posts
    462
    Thanks
    0
    Thanked 20 Times in 20 Posts
    does it work correctly without the 'checkKillSwitch' function?

    or it could have something to do with this in your loop...
    writelog($tadder . " of " . $totalcontacts . " processed >> " . $temail);
    sleep(rand(2,20));
    Last edited by c1lonewolf; 04-14-2014 at 04:13 PM.
    NO Limits!! DHCreationStation.com
    ------------------------------------------------------------
    For projects using MediaTypes (MIMETypes) visit E-BAM.net -(updated weekly)

    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com
    Global Complaint Dept.

  • #3
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by c1lonewolf View Post
    does it work correctly without the 'checkKillSwitch' function?

    or it could have something to do with this in your loop...
    writelog($tadder . " of " . $totalcontacts . " processed >> " . $temail);
    sleep(rand(2,20));
    Ah yes sorry, I forgot to mention when I take out the sleep part then all the packets will be processed rapidly and fine, but I'm not sure if that's because there wasn't enough time for the thing that's causing the error, whatever it is, to crop up.

    For the record, I need the sleep in there because ultimately this script will be sending emails so the pause is necessary.

    Here's a log of a trial run where the error crops up on packet 6 and 9 (I had to cut the rest of the log out due to forum size limit).

    Code:
    -Log cleared. --- 13/04/2014 19:01:10
    
    -Command received --- 13/04/2014 19:02:21
    -Authentification accepted --- 13/04/2014 19:02:21
    -Mailer powered on. --- 13/04/2014 19:02:21
    
    *** Sendmail script started *** --- 13/04/2014 19:02:22
    Authentification accepted --- 13/04/2014 19:02:22
    (PACKET 1 of 30) --- 13/04/2014 19:02:22
    1 of 300 processed >> Jeffrey.Creviston@mailinator.com --- 13/04/2014 19:02:22
    2 of 300 processed >> Thaddeus.Brame@mailinator.com --- 13/04/2014 19:02:37
    3 of 300 processed >> Isiah.Shutt@mailinator.com --- 13/04/2014 19:02:50
    4 of 300 processed >> Gregory.Chappell@mailinator.com --- 13/04/2014 19:03:05
    5 of 300 processed >> Kenton.Kanter@mailinator.com --- 13/04/2014 19:03:17
    6 of 300 processed >> Fredrick.Ake@mailinator.com --- 13/04/2014 19:03:32
    7 of 300 processed >> Columbus.Mayhue@mailinator.com --- 13/04/2014 19:03:41
    8 of 300 processed >> Mervin.Delagarza@mailinator.com --- 13/04/2014 19:03:49
    9 of 300 processed >> Joaquin.Pennington@mailinator.com --- 13/04/2014 19:03:57
    10 of 300 processed >> Lyman.Alaniz@mailinator.com --- 13/04/2014 19:04:14
    *** Sendmail script ended *** --- 13/04/2014 19:04:19
    
    -Command received --- 13/04/2014 19:04:19
    -Authentification accepted --- 13/04/2014 19:04:19
    -Mailer re-powered on. --- 13/04/2014 19:04:19
    
    *** Sendmail script started *** --- 13/04/2014 19:04:19
    Authentification accepted --- 13/04/2014 19:04:19
    (PACKET 2 of 30) --- 13/04/2014 19:04:19
    11 of 300 processed >> Clint.Machin@mailinator.com --- 13/04/2014 19:04:19
    12 of 300 processed >> Dominick.Hemstreet@mailinator.com --- 13/04/2014 19:04:28
    13 of 300 processed >> Brendon.Dever@mailinator.com --- 13/04/2014 19:04:31
    14 of 300 processed >> Florentino.Tippie@mailinator.com --- 13/04/2014 19:04:49
    15 of 300 processed >> Mac.Verrill@mailinator.com --- 13/04/2014 19:04:56
    16 of 300 processed >> Jesus.Mericle@mailinator.com --- 13/04/2014 19:05:00
    17 of 300 processed >> Bennett.Schwartzberg@mailinator.com --- 13/04/2014 19:05:13
    18 of 300 processed >> Deandre.Kehoe@mailinator.com --- 13/04/2014 19:05:32
    19 of 300 processed >> Robt.Champagne@mailinator.com --- 13/04/2014 19:05:46
    20 of 300 processed >> Seymour.Youngs@mailinator.com --- 13/04/2014 19:05:54
    *** Sendmail script ended *** --- 13/04/2014 19:06:14
    
    -Command received --- 13/04/2014 19:06:14
    -Authentification accepted --- 13/04/2014 19:06:14
    -Mailer re-powered on. --- 13/04/2014 19:06:14
    
    *** Sendmail script started *** --- 13/04/2014 19:06:14
    Authentification accepted --- 13/04/2014 19:06:14
    (PACKET 3 of 30) --- 13/04/2014 19:06:14
    21 of 300 processed >> Harry.Medeiros@mailinator.com --- 13/04/2014 19:06:14
    22 of 300 processed >> Ezra.Spaulding@mailinator.com --- 13/04/2014 19:06:28
    23 of 300 processed >> Craig.Avalos@mailinator.com --- 13/04/2014 19:06:38
    24 of 300 processed >> Santo.Larocco@mailinator.com --- 13/04/2014 19:06:58
    25 of 300 processed >> Clinton.Agudelo@mailinator.com --- 13/04/2014 19:07:03
    26 of 300 processed >> David.Bennet@mailinator.com --- 13/04/2014 19:07:11
    27 of 300 processed >> Terrance.Stayton@mailinator.com --- 13/04/2014 19:07:28
    28 of 300 processed >> Horacio.Browder@mailinator.com --- 13/04/2014 19:07:39
    29 of 300 processed >> Jamal.Okamura@mailinator.com --- 13/04/2014 19:07:47
    30 of 300 processed >> Bruno.Plumb@mailinator.com --- 13/04/2014 19:07:59
    *** Sendmail script ended *** --- 13/04/2014 19:08:02
    
    -Command received --- 13/04/2014 19:08:03
    -Authentification accepted --- 13/04/2014 19:08:03
    -Mailer re-powered on. --- 13/04/2014 19:08:03
    
    *** Sendmail script started *** --- 13/04/2014 19:08:03
    Authentification accepted --- 13/04/2014 19:08:03
    (PACKET 4 of 30) --- 13/04/2014 19:08:03
    31 of 300 processed >> Brant.Rawles@mailinator.com --- 13/04/2014 19:08:03
    32 of 300 processed >> Arden.Vanderpool@mailinator.com --- 13/04/2014 19:08:09
    33 of 300 processed >> Dean.Cawley@mailinator.com --- 13/04/2014 19:08:16
    34 of 300 processed >> Fidel.Gullatt@mailinator.com --- 13/04/2014 19:08:30
    35 of 300 processed >> Hong.Devenport@mailinator.com --- 13/04/2014 19:08:50
    36 of 300 processed >> Donovan.Kimberling@mailinator.com --- 13/04/2014 19:09:07
    37 of 300 processed >> Marcel.Desoto@mailinator.com --- 13/04/2014 19:09:16
    38 of 300 processed >> Saul.Gonyea@mailinator.com --- 13/04/2014 19:09:25
    39 of 300 processed >> Arnoldo.Kubala@mailinator.com --- 13/04/2014 19:09:29
    40 of 300 processed >> Herbert.Lindemann@mailinator.com --- 13/04/2014 19:09:44
    *** Sendmail script ended *** --- 13/04/2014 19:09:50
    
    -Command received --- 13/04/2014 19:09:50
    -Authentification accepted --- 13/04/2014 19:09:50
    -Mailer re-powered on. --- 13/04/2014 19:09:50
    
    *** Sendmail script started *** --- 13/04/2014 19:09:50
    Authentification accepted --- 13/04/2014 19:09:50
    (PACKET 5 of 30) --- 13/04/2014 19:09:50
    41 of 300 processed >> Ty.Youngman@mailinator.com --- 13/04/2014 19:09:50
    42 of 300 processed >> Jessie.Carrillo@mailinator.com --- 13/04/2014 19:09:58
    43 of 300 processed >> Devin.Tittle@mailinator.com --- 13/04/2014 19:10:02
    44 of 300 processed >> Jonas.Provenza@mailinator.com --- 13/04/2014 19:10:09
    45 of 300 processed >> Peter.Romanowski@mailinator.com --- 13/04/2014 19:10:14
    46 of 300 processed >> Darron.Collingsworth@mailinator.com --- 13/04/2014 19:10:23
    47 of 300 processed >> Milan.Mcclard@mailinator.com --- 13/04/2014 19:10:33
    48 of 300 processed >> Graig.Sottile@mailinator.com --- 13/04/2014 19:10:50
    49 of 300 processed >> Leland.Breazeale@mailinator.com --- 13/04/2014 19:10:57
    50 of 300 processed >> Jackson.Minix@mailinator.com --- 13/04/2014 19:11:00
    *** Sendmail script ended *** --- 13/04/2014 19:11:04
    
    -Command received --- 13/04/2014 19:11:05
    -Authentification accepted --- 13/04/2014 19:11:05
    -Mailer re-powered on. --- 13/04/2014 19:11:05
    
    *** Sendmail script started *** --- 13/04/2014 19:11:05
    Authentification accepted --- 13/04/2014 19:11:05
    (PACKET 6 of 30) --- 13/04/2014 19:11:05
    51 of 300 processed >> Herb.Burbage@mailinator.com --- 13/04/2014 19:11:05
    52 of 300 processed >> Kieth.Wilcoxson@mailinator.com --- 13/04/2014 19:11:12
    53 of 300 processed >> Colin.Schick@mailinator.com --- 13/04/2014 19:11:28
    54 of 300 processed >> Gus.Scheidler@mailinator.com --- 13/04/2014 19:11:40
    55 of 300 processed >> Palmer.Trafton@mailinator.com --- 13/04/2014 19:11:47
    56 of 300 processed >> Jaime.Quinonez@mailinator.com --- 13/04/2014 19:12:07
    57 of 300 processed >> Jewell.Berenbaum@mailinator.com --- 13/04/2014 19:12:09
    58 of 300 processed >> Terrence.Mcelvain@mailinator.com --- 13/04/2014 19:12:10
    
    *** Sendmail script started *** --- 13/04/2014 19:12:20
    Authentification accepted --- 13/04/2014 19:12:20
    (PACKET 6 of 30) --- 13/04/2014 19:12:20
    !Startup aborted as Power set to off. --- 13/04/2014 19:12:20
    
    -Command received --- 13/04/2014 19:12:20
    -Authentification accepted --- 13/04/2014 19:12:20
    -Mailer re-powered on. --- 13/04/2014 19:12:20
    
    *** Sendmail script started *** --- 13/04/2014 19:12:20
    Authentification accepted --- 13/04/2014 19:12:20
    (PACKET 7 of 30) --- 13/04/2014 19:12:20
    61 of 300 processed >> Raymundo.Avalos@mailinator.com --- 13/04/2014 19:12:20
    62 of 300 processed >> Beau.Montalbo@mailinator.com --- 13/04/2014 19:12:35
    63 of 300 processed >> Major.Miele@mailinator.com --- 13/04/2014 19:12:55
    64 of 300 processed >> Toney.Stoudemire@mailinator.com --- 13/04/2014 19:13:15
    65 of 300 processed >> Valentin.Hawbaker@mailinator.com --- 13/04/2014 19:13:33
    66 of 300 processed >> Steve.Quill@mailinator.com --- 13/04/2014 19:13:50
    67 of 300 processed >> Garland.Kohlmeier@mailinator.com --- 13/04/2014 19:14:00
    68 of 300 processed >> Cristobal.Montemayor@mailinator.com --- 13/04/2014 19:14:08
    69 of 300 processed >> Rupert.Gaddis@mailinator.com --- 13/04/2014 19:14:28
    70 of 300 processed >> Carey.Trainer@mailinator.com --- 13/04/2014 19:14:46
    *** Sendmail script ended *** --- 13/04/2014 19:15:02
    
    -Command received --- 13/04/2014 19:15:03
    -Authentification accepted --- 13/04/2014 19:15:03
    -Mailer re-powered on. --- 13/04/2014 19:15:03
    
    *** Sendmail script started *** --- 13/04/2014 19:15:03
    Authentification accepted --- 13/04/2014 19:15:03
    (PACKET 8 of 30) --- 13/04/2014 19:15:03
    71 of 300 processed >> Ivory.Miguez@mailinator.com --- 13/04/2014 19:15:03
    72 of 300 processed >> Porfirio.Beegle@mailinator.com --- 13/04/2014 19:15:22
    73 of 300 processed >> Prince.Cerrone@mailinator.com --- 13/04/2014 19:15:39
    74 of 300 processed >> Brendon.Goulet@mailinator.com --- 13/04/2014 19:15:50
    75 of 300 processed >> Carlo.Kirkpatrick@mailinator.com --- 13/04/2014 19:16:05
    76 of 300 processed >> Mohammed.Clausen@mailinator.com --- 13/04/2014 19:16:20
    77 of 300 processed >> Franklyn.Bondy@mailinator.com --- 13/04/2014 19:16:28
    78 of 300 processed >> Del.Whetzel@mailinator.com --- 13/04/2014 19:16:43
    79 of 300 processed >> Bruce.Blasingame@mailinator.com --- 13/04/2014 19:16:47
    80 of 300 processed >> Delmer.Huston@mailinator.com --- 13/04/2014 19:16:56
    *** Sendmail script ended *** --- 13/04/2014 19:17:13
    
    -Command received --- 13/04/2014 19:17:13
    -Authentification accepted --- 13/04/2014 19:17:13
    -Mailer re-powered on. --- 13/04/2014 19:17:13
    
    *** Sendmail script started *** --- 13/04/2014 19:17:13
    Authentification accepted --- 13/04/2014 19:17:13
    (PACKET 9 of 30) --- 13/04/2014 19:17:13
    81 of 300 processed >> Phil.Eslinger@mailinator.com --- 13/04/2014 19:17:13
    82 of 300 processed >> Joan.Landreth@mailinator.com --- 13/04/2014 19:17:15
    83 of 300 processed >> Alan.Watts@mailinator.com --- 13/04/2014 19:17:31
    84 of 300 processed >> Robin.Rando@mailinator.com --- 13/04/2014 19:17:39
    85 of 300 processed >> Wilbert.Feltman@mailinator.com --- 13/04/2014 19:17:43
    86 of 300 processed >> Federico.Kos@mailinator.com --- 13/04/2014 19:17:44
    
    *** Sendmail script started *** --- 13/04/2014 19:17:54
    Authentification accepted --- 13/04/2014 19:17:54
    (PACKET 9 of 30) --- 13/04/2014 19:17:54
    !Startup aborted as Power set to off. --- 13/04/2014 19:17:54
    
    -Command received --- 13/04/2014 19:17:54
    -Authentification accepted --- 13/04/2014 19:17:54
    -Mailer re-powered on. --- 13/04/2014 19:17:54
    
    *** Sendmail script started *** --- 13/04/2014 19:17:54
    Authentification accepted --- 13/04/2014 19:17:54
    (PACKET 10 of 30) --- 13/04/2014 19:17:54
    91 of 300 processed >> Gavin.Viera@mailinator.com --- 13/04/2014 19:17:54
    92 of 300 processed >> Benton.Freudenburg@mailinator.com --- 13/04/2014 19:18:05
    93 of 300 processed >> Willard.Bellinger@mailinator.com --- 13/04/2014 19:18:22
    94 of 300 processed >> Dwayne.Tseng@mailinator.com --- 13/04/2014 19:18:42
    95 of 300 processed >> Ken.Heflin@mailinator.com --- 13/04/2014 19:18:52
    96 of 300 processed >> Ed.Neisler@mailinator.com --- 13/04/2014 19:19:03
    97 of 300 processed >> Ethan.Colas@mailinator.com --- 13/04/2014 19:19:06
    98 of 300 processed >> Raymond.Croney@mailinator.com --- 13/04/2014 19:19:16
    99 of 300 processed >> Craig.Caverly@mailinator.com --- 13/04/2014 19:19:23
    100 of 300 processed >> Kenny.Bennetts@mailinator.com --- 13/04/2014 19:19:35
    *** Sendmail script ended *** --- 13/04/2014 19:19:54
    
    -Command received --- 13/04/2014 19:19:54
    -Authentification accepted --- 13/04/2014 19:19:54
    -Mailer re-powered on. --- 13/04/2014 19:19:54
    
    *** Sendmail script started *** --- 13/04/2014 19:19:55
    Authentification accepted --- 13/04/2014 19:19:55
    (PACKET 11 of 30) --- 13/04/2014 19:19:55
    101 of 300 processed >> Boris.Musselman@mailinator.com --- 13/04/2014 19:19:55
    102 of 300 processed >> Modesto.Fielding@mailinator.com --- 13/04/2014 19:20:00
    103 of 300 processed >> Troy.Hosley@mailinator.com --- 13/04/2014 19:20:05
    104 of 300 processed >> Toney.Coppola@mailinator.com --- 13/04/2014 19:20:09
    105 of 300 processed >> Chuck.Cordle@mailinator.com --- 13/04/2014 19:20:25
    106 of 300 processed >> Kerry.Malecha@mailinator.com --- 13/04/2014 19:20:29
    107 of 300 processed >> Manuel.Whitton@mailinator.com --- 13/04/2014 19:20:49
    108 of 300 processed >> Jed.Allsop@mailinator.com --- 13/04/2014 19:21:00
    109 of 300 processed >> Stewart.Frisch@mailinator.com --- 13/04/2014 19:21:05
    110 of 300 processed >> Burl.Henke@mailinator.com --- 13/04/2014 19:21:10
    *** Sendmail script ended *** --- 13/04/2014 19:21:21
    
    (log cut because too many characters for this forum)

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Posts
    462
    Thanks
    0
    Thanked 20 Times in 20 Posts
    you would need to highlight the section you're talking about...anyway from what I can make out (PACKET 6 of 30) only runs 8 items instead of ten like the rest.
    Meaning you probably have a problem in your database on that entry line (59) causing the breakdown. You could try adjusting your sleep mode a lil' higher to see
    if an error will appear.

    edit: Your error may be a sendmail error.
    "I need the sleep in there because ultimately this script will be sending emails so the pause is necessary"
    since the loop doesn't break but restarts the mail error may not be displaying.
    Last edited by c1lonewolf; 04-14-2014 at 09:59 PM.
    NO Limits!! DHCreationStation.com
    ------------------------------------------------------------
    For projects using MediaTypes (MIMETypes) visit E-BAM.net -(updated weekly)

    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com
    Global Complaint Dept.

  • #5
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by c1lonewolf View Post
    you would need to highlight the section you're talking about...anyway from what I can make out (PACKET 6 of 30) only runs 8 items instead of ten like the rest.
    Meaning you probably have a problem in your database on that entry line (59) causing the breakdown. You could try adjusting your sleep mode a lil' higher to see
    if an error will appear.

    edit: Your error may be a sendmail error.
    "I need the sleep in there because ultimately this script will be sending emails so the pause is necessary"
    since the loop doesn't break but restarts the mail error may not be displaying.
    It's not sending emails at the moment though, it's just writing the output to two log files.

    But the thing to bear in mind is that the whole thing runs perfectly when I take out the sleep time delay. It will process packets 1-30 perfectly. With this in mind it logically can't be a problem with the data, and I can't see how it would be a problem with a code.

    So I wonder why putting in the delay would make it stop on entry 8 of packet 6 of 30 like in the example... but if the delay is taken out it processes the data fine? Also, if I keep the delay in there then the error will crop up in random places, not the same place every time which further shows that it's not an issue with the data.

    I was thinking it might be a timeout issue, but I initially was getting a timeout after 20 minutes when testing it on the entire set of data. The maximum time the script is run when processing it in chunks is about 3 and half minutes... so I can't see how it's a timeout issue. But it must be something in that vain if the whole thing is processed fine without the delay in the script?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •