Question

I'm running a php script from ssh with the following command

./script.php &

The script is a has a loop in is supposed to loop about 800,000 times (so it takes a few days to run). However it is currently stopping a couple thousand loops into the process. My error handlers are not catching any error from the script but the console reads.

Write failed: Broken pipe

Can anyone shed any light on what this message means, what kind of problem this indicates, and how I might go about tracking it down?

Update:

To summarize what the script does it selects 800,000 row from a table in my data base (hosted on the same server as the script). For each row it makes a rest call to a third party site and then writes that data to a different table in the same database (hosted on the same server as the script).

Was it helpful?

Solution

Broken pipe has two causes:

  1. The program is writing to a pipe, either because it's using a function like popen() or the script's output is redirected to a pipeline, and the program reading from the pipe exits (or closes its end of the pipe for some other reason).

  2. The program is writing to a network connection, and the connection is closed by the other end.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top