Opened 9 years ago

Closed 5 years ago

#4471 closed defect (fixed)

Arm crashes with 'ControlPort auto'

Reported by: atagar Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Nyx Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Arm assumes querying 'GETCONF ControlPort' either provides an int or fails. The new 'auto' argument breaks this assumption, causing a stacktrace...

cba@cluster3:~$ sudo arm --interface
Traceback (most recent call last):
  File "/usr/share/arm/", line 390, in <module>
    interface.controller.startTorMonitor(time.time() - initTime, expandedEvents, param["startup.blindModeEnabled"])
  File "/usr/share/arm/interface/", line 1918, in startTorMonitor
    curses.wrapper(drawTorMonitor, startTime, loggedEvents, isBlindMode)
  File "/usr/lib/python2.7/curses/", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/share/arm/interface/", line 458, in drawTorMonitor
    torPid = torTools.getConn().getMyPid()
  File "/usr/share/arm/util/", line 839, in getMyPid
    return self._getRelayAttr("pid", None)
  File "/usr/share/arm/util/", line 1647, in _getRelayAttr
    result = getPid(int(self.getOption("ControlPort", 9051)), self.getOption("PidFile"))
ValueError: invalid literal for int() with base 10: 'auto'

On first glance there's four spots that need to be fixed...

atagar@morrigan:~/Desktop/arm$ grep -R "getOption(\"ControlPort" src/
src/cli/      self.vals["tor/controlPort"] = conn.getOption("ControlPort", "0")
src/cli/connections/    myCtlPort = conn.getOption("ControlPort")
src/cli/graphing/      self.controlPort = conn.getOption("ControlPort", "0")
src/util/          result = getPid(int(self.getOption("ControlPort", 9051)), self.getOption("PidFile"))

The change should be an isdigit check on the response and, if it fails, use the default value (the second argument in the getOption call or None if undefined).

This was caught by PurplePeter.

Child Tickets

Change History (1)

comment:1 Changed 5 years ago by atagar

Resolution: fixed
Severity: Normal
Status: newclosed

Just ran 'ControlPort auto' with the present master codebase and it works. Sucks since you gotta provide the random port but oh well, that's the tradeoff tor made with that feature.

Note: See TracTickets for help on using tickets.