redis / hiredis

Minimalistic C client for Redis >= 1.2
BSD 3-Clause "New" or "Revised" License
6.15k stars 1.8k forks source link

redisNetWrite crashes application process with Signal: SIGPIPE (Broken pipe) on linux if target socket was closed while sending data #1229

Open dyumin opened 9 months ago

dyumin commented 9 months ago

Please consider using MSG_NOSIGNAL send() option

MSG_NOSIGNAL (since Linux 2.2)
      Don't generate a SIGPIPE signal if the peer on a stream-oriented
      socket  has closed the connection.  The EPIPE error is still re‐
      turned.  This provides similar behavior to using sigaction(2) to
      ignore SIGPIPE, but, whereas MSG_NOSIGNAL is a per-call feature,
      ignoring SIGPIPE sets  a  process  attribute  that  affects  all
      threads in the process.