Opened 5 years ago

Closed 5 years ago

#9793 closed defect (not a bug)

stem.util.system.get_pid_by_port() doesn't work on Fedora 19

Reported by: kaie Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I'm experimenting with Stem.
The example code uses stem.util.system.get_pid_by_port(port)
to find a running process, in order to stop it.

On my Fedora 19 system, this call doesn't work, it returns "None".

The command

netstat -npltu | grep 127.0.0.1:

doesn't return the name of the process :(

tcp 0 0 127.0.0.1:9160 0.0.0.0:* LISTEN -

The lsof command doesn't work either. Looks like Fedora doesn't allow user querying of the tor process, despite me owning the process.

Child Tickets

Change History (3)

comment:1 Changed 5 years ago by atagar

Hi kaie. Please add the torrc that tor is running with, and restart tor with 'tor -f /path/to/that/file' to double check that it's running with that. In particular I'd like to double check that the ControlPort is properly set.

doesn't return the name of the process :(

Actually, this isn't a problem with Fedora or netstat/lsof but rather something tor is doing. By default tor sets the DisableDebuggerAttachment which causes some of your /proc permissions to be set to root. This in turn breaks connection resolvers like netstat and lsof (this has been a thorn in my side for quite some time with arm).

You can change this by setting "DisableDebuggerAttachment 0" in your torrc.

Cheers! -Damian

comment:2 in reply to:  1 Changed 5 years ago by kaie

Replying to atagar:

In particular I'd like to double check that the ControlPort is properly set.

It is.

You can change this by setting "DisableDebuggerAttachment 0" in your torrc.

This helped. Thanks a lot!

comment:3 Changed 5 years ago by kaie

Resolution: not a bug
Status: newclosed

Note that it seems to work fine on debian without requiring the DisableDebuggerAttachment 0 setting.

Note: See TracTickets for help on using tickets.