Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#949 closed defect (invalid)

Tor server can't bind itself to a ip address and dies.

Reported by: mavior Owned by: weasel
Priority: Low Milestone:
Component: Core Tor/Tor Version:
Severity: Keywords:
Cc: mavior, nickm, arma Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by weasel)

I am using Tor version (r18423).
I have set up Tor to bind the server to the localhost loopback and to a local network ip address.
By default the daemon is configured to start in runlevel 2 with S20tor.
When the system starts, there is a race condition of the daemons on the same run-level and if the kernel
hasn't yet registered the ip address of the local network
interface because it's querying in dhcp mode,
tor puts a message on stdout on boot that it wasn't able to bind itself to the LAN address specified and dies.

This is very annoying,because I often start the system and then I don't find the expected instance of tor running,
even if the interface and the local ip address are working.
For me it's better if the started instance of tor,keep polling for specified ip address instead of die.

Also moving the name of the file to something like S90tor on all runlevels seems to help partially as the problem seems just to slightly
decrease.(this confirm the race condition problem)

I can't attach any log output as it does not output nothing relevant in the just dies.

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

Child Tickets

Change History (8)

comment:1 Changed 11 years ago by nickm

What OS is this? What package?

comment:2 Changed 11 years ago by mavior

Well, I'm on Debian Lenny, Tor version (r18423).

comment:3 Changed 11 years ago by weasel

If you configure services to listen on individual addresses
then you might want to make sure that the networking part
actually brings them up in time for services to use them.

Changing etc/network/interfaces's allow-hotplug eth0 to
auto eth0 should do the trick. Moving the script to s90
just means that the race is less likely to screw you over,
it's not a fix.

comment:4 Changed 11 years ago by mavior

Quoting from man interfaces:
"Lines beginning with the word "auto" are used to identify the physical interfaces to be brought up when ifup is run with the -a option."

I'm reading the man page but i'm missing the point why "auto" should permit to bring eth0 up in time.
Anyway, is this a bug of tor I guess...isn't it?At least I expect it to have a more fault-tolerant policy, which means even if I can't bind to all the address configured I can't just die.
thank you for your comment

comment:5 Changed 11 years ago by weasel

auto will bring them up in rcS/40 or so. allow-hotplug will bring them up
whenever udev feels like it.

I don't know what the right thing for Tor is when the
address you told it to use is not available.

Sometimes you need root privileges to bind stuff and you want
to get rid of those as soon as possible. So you can't just
keep waiting until they all show up, else you never get anything
done. What about folks who configure tor to use addresses that
will never work? Tor just silently running but being broken
isn't all that good an idea either.

comment:6 Changed 11 years ago by mavior

I'll try your suggestion.
Well,i think that it's just to create a socket listening on that address/port pair, so I don't think that would require any special privilege.
Polling some times for the interface shouldn't be that much time/resources consuming.But polling could be also not wanted, optional...
For the standard policy: mhh in my opinion tor should keep running if it had some socket regularly listening.
If it was so, localhost socket would be regularly listening for connection.
From the perspective of a user trying to connect to the broken socket/sockets: well, what changes if tor continues to run?
After all I opened the task for tor server...

comment:7 Changed 10 years ago by weasel

Description: modified (diff)
Resolution: Noneinvalid
Status: newclosed

comment:8 Changed 8 years ago by nickm

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