What is a broken pipe error?

louie mcconnell picture louie mcconnell · Jun 9, 2014 · Viewed 14.7k times · Source

Running code in python, I discovered a "Broken Pipe Error." Can someone please explain to me what this is simply?

Thanks.

Answer

slezica picture slezica · Jun 9, 2014

A pipe connects two processes. One of these processes holds the read-end of the pipe, and the other holds the write-end.

When the pipe is written to, data is stored in a buffer waiting for the other processes to retrieve it.

What happens if a process is writing to a pipe, but the process on the other side suddenly exits or closes the pipe? Or the other way round, a process is reading just as the writer finishes or closes?

This input/output error is called a broken pipe.