[tor-bugs] #9166 [Tor]: Write a UTP-based channel implementation

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Aug 23 16:36:04 UTC 2013


#9166: Write a UTP-based channel implementation
---------------------------+------------------------------------------------
 Reporter:  nickm          |          Owner:                  
     Type:  defect         |         Status:  new             
 Priority:  normal         |      Milestone:  Tor: unspecified
Component:  Tor            |        Version:                  
 Keywords:  tor-relay utp  |         Parent:  #9165           
   Points:                 |   Actualpoints:                  
---------------------------+------------------------------------------------

Comment(by karsten):

 Progress!

  - Fixed a nasty and well-hidden segfault that I observed on directory
 authorities when running this branch in Chutney.  This problem never
 showed up in the client/private bridge setting, nor was it a problem in
 Shadow.  But it was an actual bug which is now
 [https://gitweb.torproject.org/karsten/tor.git/commitdiff/2642f47bc7fa3ddacf86d7cf3512dc0982e70fee
 fixed].

  - Got a tiny network of 3 directory authorities, 5 relays, and 2 clients
 bootstrapped in Chutney.  `tcpdump` confirms that there's quite some UDP
 traffic going on.

  - Still works in my client/private bridge setting and bootstraps within
 about 6 seconds from an empty data directory.

 So far, so good.

 (Adding a brief pause here for applause...)

 However, I didn't make any progress on Shadow simulations using the new
 branch.  Shadow simply doesn't want to call libutp's `on_read` and
 `on_write`.  For comparison, here's how often the various `tor_UTP*`
 functions are called in the '''Chutney''' network:

 {{{
 ubuntu at ip-10-8-18-21:~/src/chutney$ grep tor_UTP net/nodes/????/debug.log
 | cut -d" " -f5 | sort | uniq -c
  193561 tor_UTPGetRBSize():
      86 tor_UTPGotIncomingConnection():
       1 tor_UTPOnErrorProc():
  368788 tor_UTPOnOverheadProc():
  109627 tor_UTPOnReadProc():
    3286 tor_UTPOnStateChangeProc():
  118472 tor_UTPOnWriteProc():
  184412 tor_UTPSendToProc():
 }}}

 And here are the same calls in the '''Shadow''' network:

 {{{
 ubuntu at ip-10-8-18-21:~/src/shadow/resource/examples/scallion/minimal/data$
 grep tor_UTP scallion.log | cut -d" " -f8 | sort | uniq -c
      92 tor_UTPGetRBSize(void
      88 tor_UTPGotIncomingConnection(void
      75 tor_UTPOnErrorProc(void
     343 tor_UTPOnOverheadProc(void
     262 tor_UTPSendToProc(void
 }}}

 AFAICS, the Shadow tor nodes attempt to write cells, but only stuff them
 in their outbufs without ever sending them.  Here's an example:

 {{{
 0:0:39:272981 [thread-0] 0:7:8:369751244 [tor-debug] [relay2-59.1.0.0]
 [scalliontor_logmsg_cb] int channel_tls_write_packed_cell_method(channel_t
 *, packed_cell_t *)(): Asked to write packed cell uTP 512 bytes (560), got
 is_writable: 0
 0:0:39:273114 [thread-0] 0:7:8:369751244 [tor-debug] [relay2-59.1.0.0]
 [scalliontor_logmsg_cb] int channel_tls_write_packed_cell_method(channel_t
 *, packed_cell_t *)(): Asked to write packed cell uTP 512 bytes (1072),
 got is_writable: 0
 0:0:39:289406 [thread-0] 0:7:8:463049592 [tor-debug] [relay2-59.1.0.0]
 [scalliontor_logmsg_cb] int channel_tls_write_packed_cell_method(channel_t
 *, packed_cell_t *)(): Asked to write packed cell uTP 512 bytes (1584),
 got is_writable: 0
 0:0:39:335289 [thread-0] 0:7:9:346200001 [tor-debug] [relay2-59.1.0.0]
 [scalliontor_logmsg_cb] int channel_tls_write_packed_cell_method(channel_t
 *, packed_cell_t *)(): Asked to write packed cell uTP 512 bytes (2096),
 got is_writable: 0
 }}}

 The first line says that 512 bytes are to be sent, in addition to the 48
 bytes long connection ID.  The number in parentheses is the number of
 bytes in the outbuf ''after'' attempting to send.  So, all 560 bytes
 remain in the buffer.

 In the second line, another 512 bytes shall be sent, but they're again
 only added to the buffer.  Same applies to the third and fourth line.  And
 then tor gives up on this connection and tries another one; without
 success.

 I uploaded the full `scallion.log`
 [https://people.torproject.org/~karsten/volatile/scallion-utp-
 minimal-2013-08-23.log.bz2 here] (7.5M).

 Any idea what else I could try to make the utp branch work in Shadow?

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


More information about the tor-bugs mailing list