google / google/gvisor

Send SIGPIPE when writing to a closed pipe/socket

Open
#161 2 comments 0 reactions 0 assignees View on GitHub
area: filesystem area: networking exported priority: p2 type: cleanup type: enhancement
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 5h
Merged PRs (30d)
264

Description

man 2 write:

"EPIPE fd is connected to a pipe or socket whose reading end is closed. When this happens the writing process will also receive a SIGPIPE signal. (Thus, the write return value is seen only if the program catches, blocks or ignores this signal.)"

As is typical, the man page oversimplifies things. For sockets there are three different behaviors (that I've found so far):

SOCK_STREAM: returns EPIPE and sends SIGPIPE
SOCK_SEQPACKET: returns EPIPE and *does not* send SIGPIPE
SOCK_DGRAM: return ECONNREFUSED and does not send SIGPIPE

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.