What is a broken pipe error?
Asked Answered
P

1

15

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

Thanks.

Panelist answered 8/6, 2014 at 23:45 Comment(1)
It means that your program tried to write to a pipe (presumably connected between two processes, but you can have a pipe in a single process), but there wasn't a process left that was able to read from the pipe, so you got the 'broken pipe' error.Trend
S
30

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.

Sightly answered 8/6, 2014 at 23:49 Comment(3)
The error can't be fixed because it's just a symptom. It's telling you there's another problem. One of the two processes is closing the pipe before it should (perhaps by terminating), or the expectations of the other process are wrong. The broken pipe is not the error, it's the mismatch in process life-cycle. They are not working together correcltySightly
so, there is no fix...that's a bummer.Drench
Thank you for your help, slezica. I thought it was just a problem with my IDE or something.Drench

© 2022 - 2024 — McMap. All rights reserved.