Skip to content

Commit

Permalink
Calling application must ignore or handle SIGPIPE to avoid terminatio…
Browse files Browse the repository at this point in the history
…n if connection drops. (issue #2)
  • Loading branch information
Magnus Edenhill authored and Magnus Edenhill committed Jan 7, 2013
1 parent c818ae5 commit c15c314
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/rdkafka_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ int main (int argc, char **argv) {

signal(SIGINT, stop);

/* Socket hangups are gracefully handled in librdkafka on socket error
* without the use of signals, so SIGPIPE should be ignored by the calling
* program. */
signal(SIGPIPE, SIG_IGN);

if (mode == 'P') {
/*
* Producer
Expand Down
2 changes: 2 additions & 0 deletions rdkafka.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ void rd_kafka_destroy (rd_kafka_t *rk);
* 'conf' is an optional struct that will be copied to replace rdkafka's
* default configuration. See the 'rd_kafka_conf_t' type for more information.
*
* NOTE: Make sure SIGPIPE is either ignored or handled by the calling application.
*
*
* Returns the Kafka handle.
*
Expand Down

0 comments on commit c15c314

Please sign in to comment.