Jump to content

Sporadic Data Loss


kingoflosses

Recommended Posts

  Basically what I have is a script that loops through a set of numbers retrieved from a table in my database (using a "while" loop) and then using an included class it parses an external xml file and returns the results in an array. It then take the data from selected keys of the array I need and uses them to update the row from which the original number was pulled.

 

  The problem I'm running into is I'm randomly failing to receive the data from my xml parse/array. Sometimes my script will run perfectly for the first 1000 entries or so and then have random dropouts, while other times I will receive sporadic data from the beginning. I'm pretty sure I have ruled out script timeout and lack of memory and I've tried everything I can think of to find the problem. I don't receive any php or mysql errors while running my script, so that hinders me in trying to pinpoint the problem.

 

  One idea I had was that the xml page might not be loading and being parsed fast enough and it was being skipped in my while loop, but I'm not sure how I would check for that or how I would remedy it. The method I'm using to see if I'm receiving data in my array from the xml parse is a simple if/else statement in my while loop. In the "If" statement I look for a certain array key that should be present, and if it returns null I have it echo the number pulled from my table in red font color. Otherwise I have it echoing the number in blue font.

 

  I have no clue where to go from here in my troubleshooting. I've tried too many approaches to fixing this to post them all here, and I'm not sure what part of my script would be best to post at this point. Actually, I'm not even positive if it's a problem with my original php script, my xml to array class, or something wacky with mysql. Any help is greatly appreciated though. If it helps, I'm using php 4.4.7 on an Apache webserver.

Link to comment
Share on other sites

I have a few similar weird issues with mySQL every once in a while failing on a query where the server goes away.  I've checked with the server people and spent countless hours tracking it down without any luck.  If it runs perfectly but has this issue every 3000 times or something, I wouldn't worry about it.  If it happens every other time, then obviously you have to continue to track it down.  I seriously doubt it is your PHP code as long as you know what you are doing (and it sounds like you probably do). 

Link to comment
Share on other sites

  Well, I'm pretty sure it's not a problem with my mysql queries because I am receiving the correct row number every time during my "While" Loop. The rate at which I fail to receive my array data varies wildly. Sometimes it will go fine for a while, and then I will lose large chunks.

 

  This is an example of the problem I've been running into. Each number in blue is a success and each red is a fail. If you refresh the script you will see that the number, position and frequency of red numbers changes each time. It's driving me crazy and I would like to avoid having to run numerous crons during the day just to be sure the entire list gets updated. Again, thanks for any help that can be offered  :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.