[or-cvs] declare the epipe bug a non-bug.

Roger Dingledine arma at seul.org
Tue Jun 1 17:31:16 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	buffers.c main.c 
Log Message:
declare the epipe bug a non-bug.

now we catch and ignore epipe signals, and when write returns epipe,
we simply return -1 and close the socket/connection.


Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- buffers.c	19 May 2004 19:28:24 -0000	1.94
+++ buffers.c	1 Jun 2004 17:31:13 -0000	1.95
@@ -250,8 +250,6 @@
   write_result = send(s, buf->mem, *buf_flushlen, 0);
   if (write_result < 0) {
     if(!ERRNO_IS_EAGAIN(tor_socket_errno(s))) { /* it's a real error */
-      /* get a stack trace to find epipe bugs */
-      tor_assert(tor_socket_errno(s) != EPIPE);
       return -1;
     }
     log_fn(LOG_DEBUG,"write() would block, returning.");

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.277
retrieving revision 1.278
diff -u -d -r1.277 -r1.278
--- main.c	28 May 2004 17:56:17 -0000	1.277
+++ main.c	1 Jun 2004 17:31:13 -0000	1.278
@@ -347,8 +347,6 @@
      !conn->marked_for_close &&
      conn->timestamp_lastwritten + 5*60 < now) {
     log_fn(LOG_WARN,"Expiring wedged directory conn (fd %d, purpose %d)", conn->s, conn->purpose);
-    /* XXXX This next check may help isolate where the pesky EPIPE bug
-     * really occurs. */
     if (connection_wants_to_flush(conn)) {
       if(flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen) < 0) {
         log_fn(LOG_WARN,"flushing expired directory conn failed.");
@@ -752,7 +750,7 @@
         unlink(options.PidFile);
       exit(0);
     case SIGPIPE:
-      log(LOG_WARN,"Bug: caught sigpipe. Ignoring.");
+      log(LOG_INFO,"Caught sigpipe. Ignoring.");
       break;
     case SIGHUP:
       please_reset = 1;



More information about the tor-commits mailing list