Redis legacy command path can terminate the process with SIGPIPE

Closed
#642 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c, redis

Research direction

Start in src/net/redis/cwist_redis.c at redis_send_all() (lines 121–136), then compare its send handling with the deadline-bounded implementation that uses CWIST_REDIS_NOSIGNAL and SO_NOSIGPIPE. Add regression coverage for normal cwist_redis_command*() and SUBSCRIBE calls with default SIGPIPE behavior when the peer resets the connection. Done means both calls return an error without terminating the process, while EINTR handling remains intact.

Written by the indexing model from the issue text.

Description

bug critical

Affected: dev at bb2a33946.

redis_send_all() calls send(..., 0) (src/net/redis/cwist_redis.c:121-136). It is used by normal commands and SUBSCRIBE through redis_command_frame_tree() and send_command(). On POSIX, writing after the Redis peer resets or closes the connection can raise SIGPIPE and kill the entire server process instead of returning a CWIST error.

The deadline-bounded implementation already uses CWIST_REDIS_NOSIGNAL and configures SO_NOSIGPIPE where available, but the legacy path does not.

Expected: suppress SIGPIPE on every legacy send with MSG_NOSIGNAL or the platform socket option, preserve EINTR handling, and return an error. Add a default-SIGPIPE regression test where the peer resets the connection during a normal cwist_redis_command*() call and during SUBSCRIBE.

Dominant language
C
Stars
16
Forks
7
Avg merge
5h 1m
Merged PRs (30d)
197

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c4punks/CWIST

All issues in c4punks/CWIST

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.