php script randomly restarting itself with POST data

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

holdorfold
New php-forum User
New php-forum User
Posts: 3
Joined: Wed Jan 25, 2012 6:56 pm

php script randomly restarting itself with POST data

Postby holdorfold » Mon Apr 14, 2014 8:45 am

I'm having an issue and I can't figure out for the life of me what the problem is.

I've got an AJAX request which parses packets of data to a php script which processes the packet and writes the output to a log.

The whole thing runs perfectly ... unless I put a sleep(rand(2,20)); in the php script which makes it pause for awhile after processing each element in a packet. When I put the time delay in then sometimes in the middle of processing a packet the php script will seemingly stop and restart itself and process the whole packet again.

I've ruled out that the AJAX might be sending the request again while the php script is running by putting a flag in the AJAX so it can't send anything while the phpscript is running.

What could be causing this? I can't find anything about the problem.

Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 3 guests