[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-relays] help w/ Debian: Error binding network socket: Address already in use



On Mon, Apr 04, 2011 at 03:37:25PM +0200, Olaf Selke wrote:
> Apr 04 15:27:48.706 [warn] Error binding network socket: Address already in use
> 
> I'm a little bit clueless what's wrong here. I've read
> http://hea-www.harvard.edu/~fine/Tech/addrinuse.html and found SO_REUSEADDR
> being used in connection.c. Tor opens about 1k new tcp connections/s and the
> average number of open tcp sessions is about 70k.
> 
> anonymizer2:/tmp# netstat -tn | wc -l
> 70597
> 
> Any ideas why Tor can't bind to sockets? 

Actually, we only use SO_REUSEADDR when binding listening sockets. The
errors you're seeing are likely because you can't open a new socket
for an outbound connection. And we don't use SO_REUSEADDR when creating
outbound sockets: see connection_connect().

We also don't set SO_REUSEADDR on the new socket we make after receiving
connections on a listening socket: see connection_handle_listener_read().

I don't know what behavior to expect, but I would not be surprised
to learn that we should set it in both of these cases too. Worth
experimenting.

--Roger

_______________________________________________
tor-relays mailing list
tor-relays@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays