Opened 10 years ago

Last modified 7 years ago

#1143 closed defect (Fixed)

Tor can't start if DNS Port enabled in torrc

Reported by: stars Owned by:
Priority: High Milestone:
Component: Core Tor/Tor Version: 0.2.2.5-alpha
Severity: Keywords:
Cc: stars, Sebastian, nickm, arma Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hello,

Today i updated my tor origin/master 0.2.2.5 alpha commit 69c0147ea6725a63f254333867c0504528c62daf and i was unable to start tor.

I run kubuntu karmic 9.10 on x86 64, kernel: 2.6.31-15-generic and libevent 2.0.2 alpha Path: .
URL: https://levent.svn.sourceforge.net/svnroot/levent/trunk/libevent
Repository Root: https://levent.svn.sourceforge.net/svnroot/levent
Repository UUID: ce677c24-8c1a-0410-9497-a30ef3a96221
Revision: 1516
Node Kind: directory
Schedule: normal
Last Changed Author: nickm
Last Changed Rev: 1516
Last Changed Date: 2009-11-06 22:46:57 +0100 (ven, 06 nov 2009)

After a few hours , i have found that was the "DNSPort xx DNS , ListenAddress 127.0.0.1:xxxx " when enabled who crash tor at start.
If i disable it, it start normally .

i have already report in libevent bug tracker the 2 kernel errors found in my log but give info here while i dunno what cause it.

2009-11-08 21:40:22 moon kernel [ 6907.854009] tor[11345]: segfault at 0 ip 00007f39cf943b18 sp 00007fff6dd87860 error 4 in libevent.so.2.0.0[7f39cf929000+40000]
2009-11-08 21:41:10 moon kernel [ 6955.458940] tor[11355]: segfault at 0 ip 00007f8ae258bb18 sp 00007fff58df22a0 error 4 in libevent.so.2.0.0[7f8ae2571000+40000]

best regards

SwissTorExit

[Automatically added by flyspray2trac: Operating System: Other Linux]

Child Tickets

Attachments (2)

core (588.0 KB) - added by stars 10 years ago.
stack trace
stack trace 2 the right (5.0 KB) - added by stars 10 years ago.
stack trace, the right

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by nickm

This really needs a stack trace to be debuggable.

Changed 10 years ago by stars

Attachment: core added

stack trace

comment:2 Changed 10 years ago by stars

hi Nick,

I am sorry to have not added yesterday, i was not able to create it but weasel have help me and at end the "core" file was create.

i have attached it now.

best regards

comment:3 Changed 10 years ago by nickm

Hi! In order to turn a core file into a stack trace, you need to use gdb. We have instructions at
https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ#ReportBug
for how to do this.

comment:4 Changed 10 years ago by stars

oups, sorry, i was on the page but have miss a step. i have added it now.

I hope that's ok. if not told me.

Best regards

Changed 10 years ago by stars

Attachment: stack trace 2 the right added

stack trace, the right

comment:5 Changed 10 years ago by nickm

#0 0x00007f04bce6cb18 in evmap_io_add ()

from /usr/local/lib/libevent.so.2

(gdb) bt
#0 0x00007f04bce6cb18 in evmap_io_add ()

from /usr/local/lib/libevent.so.2

#1 0x00007f04bce5f0d0 in event_add_internal ()

from /usr/local/lib/libevent.so.2

#2 0x00007f04bce5eddd in event_add ()

from /usr/local/lib/libevent.so.2

#3 0x00007f04bce7ab9d in evdns_add_server_port_with_base ()

from /usr/local/lib/libevent.so.2

#4 0x00007f04bce7ac20 in evdns_add_server_port ()

from /usr/local/lib/libevent.so.2

#5 0x000000000049c345 in dnsserv_configure_listener (

conn=0x2069cb0) at dnsserv.c:302

#6 0x0000000000469c0b in connection_create_listener (type=15,

cfg=<value optimized out>,
port_option=<value optimized out>,
default_addr=<value optimized out>,
replaced_conns=<value optimized out>,
new_conns=<value optimized out>, disable_all_conns=0,
socket_family=2) at connection.c:958

#7 retry_listeners (type=15, cfg=<value optimized out>,

port_option=<value optimized out>,
default_addr=<value optimized out>,
replaced_conns=<value optimized out>,
new_conns=<value optimized out>, disable_all_conns=0,
socket_family=2) at connection.c:1775

#8 0x000000000046a55b in retry_all_listeners (

replaced_conns=0x2063300, new_conns=0x2068410)
at connection.c:1838

Interesting. We're using the evdns_add_server_port from Libevent. It's succeeding the first time, but failing
when we call retry_all_listeners.

comment:6 Changed 10 years ago by Sebastian

A bisect showed that the last good libevent commit is
19dad16699ddf396c87e7c44c174e6716c0d160c, the first bad commit is
d776f8462be6c68ac4cd7bf3903710aad5dd842b. All commits inbetween
generate compile errors with Tor, so it's hard to bisect further.

comment:7 Changed 10 years ago by Sebastian

Here's a patch that gets rid of the segfault. I don't think it's the right patch, though,
the bug is in libevent (calling evdns_add_server_port sets an event base of NULL,
which is later dereferenced).

diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index 256dcbd..2620945 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -299,8 +299,9 @@ dnsserv_configure_listener(connection_t *conn)

tor_assert(conn->s >= 0);
tor_assert(conn->type == CONN_TYPE_AP_DNS_LISTENER);


  • conn->dns_server_port = evdns_add_server_port(conn->s, 0,
  • evdns_server_callback, NULL);

+ conn->dns_server_port =
+ evdns_add_server_port_with_base(tor_libevent_get_base(), conn->s, 0,
+ evdns_server_callback, NULL);

}


/ Free the evdns server port for <b>conn</b>, which must be an

comment:8 Changed 10 years ago by Sebastian

Put the above patch in branch bug1143 in my repo.

Setting the event base to current_base in various places in event.c also
helps to get rid of the crash, but I have no clue what the current_base
logic does or how it is supposed to work ;)

comment:9 Changed 10 years ago by Sebastian

Patch reworked a little to make it work with old versions of libevent,
merged to master.

comment:10 Changed 10 years ago by Sebastian

flyspray2trac: bug closed.

comment:11 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.