[tor-bugs] #4457 [Tor Client]: Assertion at startup on Windows 7 when socketpair fails (was: tor quit)

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Mon Nov 14 14:33:09 UTC 2011


#4457: Assertion at startup on Windows 7 when socketpair fails
------------------------+---------------------------------------------------
 Reporter:  Vigdis      |          Owner:                    
     Type:  defect      |         Status:  new               
 Priority:  major       |      Milestone:  Tor: 0.2.2.x-final
Component:  Tor Client  |        Version:  Tor: 0.2.2.34     
 Keywords:              |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------
Changes (by Sebastian):

  * priority:  normal => major
  * milestone:  Vidalia: 0.2.15 => Tor: 0.2.2.x-final
  * version:  Tor: 0.2.2.33 => Tor: 0.2.2.34
  * component:  Tor Bridge => Tor Client


Comment:

 If I understand it correctly, what happens here is the following:

 We call tor_libevent_initialize(), where we have
 the_event_base = event_base_new_with_config(cfg);.

 A little below, we call

 {{{
  log(LOG_NOTICE, LD_GENERAL,
      "Initialized libevent version %s using method %s. Good.",
      event_get_version(), tor_libevent_get_method());
 }}}
 with the call to tor_libevent_get_method(), which calls
 event_base_get_method(the_event_base);.

 The call asserts, because the_event_base is NULL. It is NULL because
 inside of event_base_new_with_config(), we have this section of code:

 {{{
 #ifndef _EVENT_DISABLE_THREAD_SUPPORT
        if (!cfg || !(cfg->flags & EVENT_BASE_FLAG_NOLOCK)) {
                int r;
                EVTHREAD_ALLOC_LOCK(base->th_base_lock,
                    EVTHREAD_LOCKTYPE_RECURSIVE);
                base->defer_queue.lock = base->th_base_lock;
                EVTHREAD_ALLOC_COND(base->current_event_cond);
                r = evthread_make_base_notifiable(base);
                if (r<0) {
                        event_base_free(base);
                        return NULL;
                }
        }
 #endif
 }}}

 evthread_make_base_notifiable() returns -1 here, because the
 evutil_socketpair() call fails.


 The first part would be checking that we actually get an event base back
 from event_base_new_with_config(), and telling the user about the cause
 of error. But maybe we can do even better with a new libevent version
 that doesn't require the socketpair to work, or we can get away with not
 requiring it from Tor?

 Thanks frosty_un for looking at this with me.

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


More information about the tor-bugs mailing list