Skip to content

Stream hangs while downloading consensus via RELAY_BEGIN_DIR

After performing the following sequence of steps to download a consensus through a stream, Tor hangs after sending 58 (17 with deflate) cells:

  1. Open an TLS connection to a local OR.
  2. Negotiate a v5 link on the connection.
  3. Create a circuit via CREATE_FAST.
  4. Create a stream via RELAY_BEGIN_DIR.
  5. Send a request to download a consensus.

I managed to reproduce the issue with the code attached. Here are an excerpt of the file:

'''Using identity, we get 58 RELAY_DATA cells before hanging, 17 with deflate.

    Affected:
        Tor version 0.3.4.0-alpha-dev (git-3463b4e0652bacca).

    Not affected:
        Tor version 0.3.3.5-rc-dev (git-3ee4c9b1fae9d535).
'''

compression = b'identity' # or b'deflate'

'''Issue reproduced with the code below, originally bisected on [1].

        From tag:tor-0.3.4.1-alpha                      Affected?

        deb8970a29ef7427c3d42182d3bacc31ab602c03        yes
        2d7b5c6fe5dc46b7e7cd040e6723e25d12015985        yes
        3fa66f97996c179388fa91176b9a82fb9b5b31d8        no
        306563ac68250872791350bda1ba7a7acff5eb63        no
        3ee4c9b1fae9d53556b3e3be852f12e9abe51e14        no
        c32108ee0fea851ced14f71d842390992f762393        yes
        22845df2a7503ed73ed325c3a98916f289918caa        no
        c7d3de216c60c090fddb4926a739da038bb5d5fe        yes
        9ef4c05df8323850b5894782f435da15810d6189        no
        5e0fbd7006993a4e402f2eee49f6f86074923197        no
        c5899d5cf3a761f4049c1d6f05232731edcfeb57        no
        3463b4e0652bacca51fecd2c256e3e9d61ce920e        yes

    [1] Unpublished (yet) python client, no link here, sorry :(

    Usage:
        virtualenv venv
        source venv/bin/activate
        pip install -r stem cryptography
        tor PublishServerDescriptor 0 AssumeReachable 1 ExitRelay 0 ProtocolWarnings 1 SafeLogging 0 LogTimeGranularity 1 PidFile '$(mktemp)' SOCKSPort 0 ContactInfo none@example.com DataDirectory '$(mktemp -d)' ORPort 9050 DirPort 9051 Log 'err stderr' &

        python reproduce.py
'''

I provided the redacted logs for two different versions, one affected and one not.

Trac:
Username: plcp`

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information