[tor-bugs] #10532 [Tor]: [Tor relay] Random hangs

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Jan 17 16:29:37 UTC 2014


#10532: [Tor relay] Random hangs
---------------------------+------------------------------
     Reporter:  mrc0mmand  |      Owner:
         Type:  defect     |     Status:  new
     Priority:  normal     |  Milestone:
    Component:  Tor        |    Version:  Tor: unspecified
   Resolution:             |   Keywords:
Actual Points:             |  Parent ID:
       Points:             |
---------------------------+------------------------------

Comment (by nickm):

 It looks like cpunks deleted whatever patch he wrote above before I had a
 chance to see it.

 His theory, as I understand it, is that write() is returning 0 rather than
 blocking when trying to write to a full socket or file.  That doesn't seem
 like correct behavior to me, but let's try it out.

 I've attached a trivial patch that will fix the problem if that's the
 case.  Can you try it out?
 {{{
 diff --git a/src/common/util.c b/src/common/util.c
 index 054de3d..0665720 100644
 --- a/src/common/util.c
 +++ b/src/common/util.c
 @@ -1762,6 +1762,9 @@ write_all(tor_socket_t fd, const char *buf, size_t
 count, int isSocket)
        result = write((int)fd, buf+written, count-written);
      if (result<0)
        return -1;
 +    else if (result == 0) {
 +      log_notice(LD_BUG, "Apparently write() can return 0.")
 +    }
      written += result;
    }
    return (ssize_t)count;
 }}}

 Also, if you're hitting OOM conditions, you should make sure that you're
 using the MaxMemInCellQueues option.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/10532#comment:29>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list