Skip to content
  • anonym's avatar
    onion-grater: retry connecting to the real control port. · f74cec4d
    anonym authored
    This should not be necessary and is just placed here as a workaround
    until I can figure out the real issue (bug in onion-grater? bug in
    stem?).
    
    When working on the Tor Browser 9.0 migration there were issues with
    Tor Launcher. It starts and does its initial connection to the control
    port where it successfully fetches CONFs etc. When clicking "Connect"
    it successfully sends a few more things and disconnects, only to
    reconnect immediately later (due to some implementation detail in Tor
    Launcher). This reconnection fails:
    
        [...]
        /usr/local/lib/tor-browser/firefox-unconfined (pid: 8865, user: tor-launcher, port: 57472, filter: tor-launcher): -> SAVECONF
        /usr/local/lib/tor-browser/firefox-unconfined (pid: 8865, user: tor-launcher, port: 57472, filter: tor-launcher) disconnected: Client closed its socket
        [ Here comes the reconnect: ]
        /usr/local/lib/tor-browser/firefox-unconfined (pid: 8865, user: tor-launcher, port: 57476, filter: tor-launcher) connected: loaded filter: tor-launcher
        Final rules: [...]
        Unable to connect to tor. Maybe it's running without a ControlPort?
        /usr/local/lib/tor-browser/firefox-unconfined (pid: 8865, user: tor-launcher, port: 57476, filter: tor-launcher) disconnected: client quit
        ----------------------------------------
        Exception happened during processing of request from ('127.0.0.1', 57476)
        Traceback (most recent call last):
          File "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread
            self.finish_request(request, client_address)
          File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
            self.RequestHandlerClass(request, client_address, self)
          File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
            self.handle()
          File "/usr/local/lib/onion-grater", line 629, in handle
            self.controller = self.connect_to_real_control_port()
          File "/usr/local/lib/onion-grater", line 570, in connect_to_real_control_port
            stem.connection.authenticate_cookie(controller, cookie_path=global_args.control_cookie_path)
          File "/usr/lib/python3/dist-packages/stem/connection.py", line 803, in authenticate_cookie
            auth_response = _msg(controller, msg)
          File "/usr/lib/python3/dist-packages/stem/connection.py", line 1055, in _msg
            return controller.msg(message)
        AttributeError: 'NoneType' object has no attribute 'msg'
        ----------------------------------------
    
    But if we just connect yet again, it works, hence the workaround.
    
    Refs: #16356, #15709
    f74cec4d