Opened 5 years ago

Closed 3 years ago

#13513 closed defect (worksforme)

Tor randomly hangs

Reported by: Giova84 Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor: 0.2.3.25
Severity: Normal Keywords: tor-relay, haiku, beos, tor-03-unspecified-201612
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I successfully run Tor on Haiku (OS) since years, but recently (about two weeks), it will hangs randomly: with "hangs" i mean that will take the whole cpu usage and i cannot browse. As i've said, this happens randomly, not every times.
I have enabled a log file: when Tor hangs this file become gigantic: in about three second it grows until 56MB. Since this file is so big, i just cut the end. This logfile will end with the following message, which is continuosly repeated until i kill Tor in a Terminal window:

Log file: http://pastebin.com/09kqFMmG

Last message (continuosly repeated):

ct 22 01:09:12.000 [debug] conn_read_callback(): socket 19 wants to read.
Oct 22 01:09:12.000 [debug] tor_tls_handshake(): About to call SSL_connect on 0x18065d80 (SSLv2/v3 read server hello A)
Oct 22 01:09:12.000 [debug] tor_tls_debug_state_callback(): SSL 0x18cb2c48 is now in state SSLv2/v3 read server hello A [type=4098,val=-1].
Oct 22 01:09:12.000 [debug] connection_tls_continue_handshake(): wanted read

Child Tickets

Change History (15)

comment:1 Changed 5 years ago by nickm

Milestone: Tor: 0.2.6.x-final

Thanks for those logs; I think this will help.

Has anybody seen this on any other platform?

This is with a client with the default configuration, or with any interesting options set?

Does this also happen with 0.2.4 or with 0.2.5?

comment:2 Changed 5 years ago by Giova84

Hi,

this happens without any clients: I'm investigating on this issue since some days; it happens also without any client which uses Tor. The torrc file is set as default. just 127.0.0.1 and 9050 as listening port.
In anyway, few minutes ago i have finished to built Tor v0.2.4.25 (git-6b2ed1a905ce2ca5) with Libevent 2.0.21-stable and OpenSSL 1.0.0o. I will let you know if this fresh-compiled version will work without issues.

comment:3 Changed 5 years ago by Giova84

Here we go again: TOR is stuck again, but after all these days: initially it seemed stable. Today i have seen the same behaviour: it randomly hangs, while occupying the whole cpu process. This is happened again without any client connected to TOR. In these days i have used TOR with a client and also left in standby, and all was fine, except for today.
The output log was similar to the previous:
http://pastebin.com/dEhtucMm

It ends with this repeated message:

Oct 27 16:03:19.000 [debug] conn_read_callback(): socket 17 wants to read.
Oct 27 16:03:19.000 [debug] tor_tls_handshake(): About to call SSL_connect on 0x19344fe8 (SSLv2/v3 read server hello A)
Oct 27 16:03:19.000 [debug] tor_tls_debug_state_callback(): SSL 0x1a60f890 is now in state SSLv2/v3 read server hello A [type=4098,val=-1].
Oct 27 16:03:19.000 [debug] connection_tls_continue_handshake(): wanted read
Oct 27 16:03:19.000 [debug] conn_read_callback(): socket 17 wants to read.
Oct 27 16:03:19.000 [debug] tor_tls_handshake(): About to call SSL_connect on 0x19344fe8 (SSLv2/v3 read server hello A)
Oct 27 16:03:19.000 [debug] tor_tls_debug_state_callback(): SSL 0x1a60f890 is now in state SSLv2/v3 read server hello A [type=4098,val=-1].
Oct 27 16:03:19.000 [debug] connection_tls_continue_handshake(): wanted read
Oct 27 16:03:19.000 [debug] conn_read_callback(): socket 17 wants to read.
Oct 27 16:03:19.000 [debug] tor_tls_handshake(): About to call SSL_connect on 0x19344fe8 (SSLv2/v3 read server hello A)
Oct 27 16:03:19.000 [debug] tor_tls_debug_state_callback(): SSL 0x1a60f890 is now in state SSLv2/v3 read server hello A [type=4098,val=-1].
Oct 27 16:03:19.000 [debug] connection_tls_continue_handshake(): wanted read
Oct 27 16:03:19.000 [debug] conn_read_callback(): socket 17 wants to read.

If i don't kill TOR, the debug file, as before, will grow without limits.

comment:4 Changed 5 years ago by Giova84

I forget to say that when this issue happens, and i kill TOR, i can restart it again and will work again, without issues, until, when randomly, it hangs as described.

comment:5 Changed 5 years ago by Giova84

Sorry for the noise: i spoke too soon: after killing and restarted TOR, it hangs again.

This time i can see some different message in the log:

Oct 27 16:28:04.000 [debug] tor_tls_read(): read returned r=-1, err=-2
Oct 27 16:28:04.000 [debug] connection_read_to_buf(): After TLS read of 0: 0 read, 0 written
Oct 27 16:28:04.000 [debug] connection_or_process_cells_from_inbuf(): 17: starting, inbuf_datalen 0 (0 pending in tls object).
Last edited 5 years ago by Giova84 (previous) (diff)

comment:6 Changed 5 years ago by nickm

I wonder, when building libevent on this platform, does it pass all its unit tests?

comment:7 Changed 5 years ago by nickm

Keywords: tor-relay haiku beos added
Milestone: Tor: 0.2.6.x-finalTor: 0.2.???
Status: newneeds_information

This is probably going to require somebody with Haiku/BeOS expertise to figure out. The only angle I can think of is to ask whether anything got upgraded or changed right before Tor stopped working -- was it a new Haiku, a new libevent, a new Tor, or anything like that?

comment:8 in reply to:  7 Changed 5 years ago by Giova84

Replying to nickm:

This is probably going to require somebody with Haiku/BeOS expertise to figure out. The only angle I can think of is to ask whether anything got upgraded or changed right before Tor stopped working -- was it a new Haiku, a new libevent, a new Tor, or anything like that?

I reported this issue also on the Haiku's bug tracker

In anyway: I compiled various Tor releases with various versions of libevent (static and dynamic), but this problem still occurs. More info here: https://dev.haiku-os.org/ticket/11606

Feel free to join to the ticket that I reported on Haiku's bug tracker.
Thanks.

comment:9 Changed 5 years ago by cypherpunks

Could you to test client if tls connection dropped just after client sent hello.
Simplest way to test it with custom fake bridge, using code like this:

#!/usr/bin/env python

import socket
import sys


def create_server(ip,port):
	sock_rc=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
	sock_rc.bind((ip,port))
	sock_rc.listen(10)
	while True:
		connection,addr_info=sock_rc.accept()
		data = connection.recv(1)
		connection.close()

if __name__=='__main__':
	try:
		ip="127.0.0.1"
		port=4433
		create_server(ip,port)
	except Exception,e:
		sys.stdout.write('Error on create server\n')

It's reading 1 byte of client hello and then closing socket, triggering rst packet.
Add to torrc file:

UseBridges 1
Bridge 127.0.0.1:4433

Interesting to know what openssl reports ("connection_tls_continue_handshake():" line of logs) with such bridge for your case.

comment:10 Changed 5 years ago by Giova84

Well, I have done this test and nothing happens: Tor doesn't hangs and I cannot navigate with the browser.
In anyway the following is the output of debug.log created after this test:
http://pastebin.com/sQZ3nDpE

comment:11 Changed 5 years ago by cypherpunks

comment:12 Changed 5 years ago by Giova84

On the Haiku's bug tracker I've attached some debug reports: I hope that these logs could help to find out the issue: https://dev.haiku-os.org/attachment/ticket/11606/
Many thanks to the whole Tor's team for the attention

comment:13 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:14 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:15 Changed 3 years ago by nickm

Resolution: worksforme
Severity: Normal
Status: needs_informationclosed

Please reopen if this turns out not to be a haiku issue?

Note: See TracTickets for help on using tickets.