Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #2812

Closed
Open
Opened Mar 29, 2011 by Damian Johnson@atagar

TorCtl Zombie Connections

Hi, when TorCtl fails to authenticate it leaves a connection to the ControlPort. To repro...

a. Start TBB with it configured to use cookie authentication. TBB uses relative paths for cookies so TorCtl is gonna fail to connect (separate issue, related to https://trac.torproject.org/projects/tor/ticket/1101). On a side note, arm has a somewhat platform specific workaround for this (no windows) if you're interested.

b. Check initial connections. You'll see one for Vidalia.

atagar@fenrir:~/Desktop/arm/src$ netstat -np | grep "127.0.0.1:9051.*ESTABLISHED 5267/tor" tcp 0 0 127.0.0.1:9051 127.0.0.1:36863 ESTABLISHED 5267/tor

c. Have TorCtl try (and fail) to connect a few times:

from TorCtl import TorCtl TorCtl.connect() Failed to read authentication cookie (file doesn't exist): ./Data/Tor/control_auth_cookie TorCtl.connect() Failed to read authentication cookie (file doesn't exist): ./Data/Tor/control_auth_cookie

d. Check again with netstat. You'll see a new connection for each attempt you made:

atagar@fenrir:~/Desktop/arm/src$ netstat -np | grep "127.0.0.1:9051.*ESTABLISHED 5267/tor" tcp 0 0 127.0.0.1:9051 127.0.0.1:45175 ESTABLISHED 5267/tor
tcp 0 0 127.0.0.1:9051 127.0.0.1:36863 ESTABLISHED 5267/tor
tcp 0 0 127.0.0.1:9051 127.0.0.1:45177 ESTABLISHED 5267/tor

Note that calling close on the connections or sockets is not sufficient (nor is most other things I've tried this last hour). The only thing I've found that does the trick is calling "s.shutdown(socket.SHUT_RDWR)" on the failed socket (see attached patch).

Cheers! -Damian

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#2812