Error Codes Wiki

Linux errno 32 (EPIPE) — Broken Pipe

Informationalerrno

Overview

Linux errno 32 (EPIPE) means a write was attempted on a pipe or socket whose reading end has been closed.

Key Details

  • EPIPE — broken pipe, reader has disconnected
  • Also generates SIGPIPE signal (default: terminate process)
  • Common in piped commands and network programming
  • Handle by ignoring SIGPIPE or checking write return values

Common Causes

  • Pipe reader process terminated before writer finished
  • Network client disconnected while server was sending data
  • Head command only reads partial output then exits
  • Socket peer closed the connection

Steps

  1. 1For scripts: pipe output to head/tail can cause EPIPE (normal)
  2. 2For programs: ignore SIGPIPE signal with signal(SIGPIPE, SIG_IGN)
  3. 3Check write() return value for errors
  4. 4Use MSG_NOSIGNAL flag with send() on sockets

Tags

linuxerrnoerrno 32 epipetroubleshootingfix

More in Errno

Frequently Asked Questions

In piping commands, it is normal (e.g., yes | head). In network code, it means the client disconnected.