Skip to content
Snippets Groups Projects
  1. Oct 30, 2017
    • Damian Johnson's avatar
      Provide a nicer error when sqlite3 is unavailable · 4bfe05dc
      Damian Johnson authored
      Oops! Turns out this isn't available by default on FreeBSD or Gentoo. Providing
      a nicer notice, encouraging folks to contact us so we can provide per-platform
      suggestions for how to get it.
      4bfe05dc
    • Damian Johnson's avatar
      Suppress errors if os.putenv doesn't work · bcb01229
      Damian Johnson authored
      These are to sidestep issues on some platforms. Generally certainly fine if
      they don't take effect. Caught thanks to tor-relays@ beta tester on FreeBSD...
      
        nyx: environment corrupt; missing value for
        Traceback (most recent call last):
          File "./run_nyx", line 14, in <module>
            nyx.main()
          File "/usr/home/ryan/nyx/nyx/__init__.py", line 147, in main
            nyx.starter.main()
          File "/usr/home/ryan/nyx/stem/util/conf.py", line 289, in wrapped
            return func(*args, config = config, **kwargs)
          File "/usr/home/ryan/nyx/nyx/starter.py", line 90, in main
            os.putenv('LANG', 'C')  # make subcommands (ps, netstat, etc) provide
        english results
        OSError: [Errno 14] Bad address
      bcb01229
    • Damian Johnson's avatar
      Make tests python 3.x compatible · c551866e
      Damian Johnson authored
      c551866e
    • Damian Johnson's avatar
      Nyx cpu usage metric incorrect · 46d782d0
      Damian Johnson authored
      Hey, it's only a couple orders of magnitude.
      
      ... *sigh*.
      46d782d0
    • Damian Johnson's avatar
      Fix tor cpu usage metric · 436016d1
      Damian Johnson authored
      Why did we divide by that? Weird. Because of it we always showed tor's cpu
      usage as 0%.
      436016d1
    • Damian Johnson's avatar
      Better logging when tracker has an unexpected exception · 494a39ed
      Damian Johnson authored
      We shouldn't silently swallow errors. Opting for notice runlevel so they're
      visible to users by default so they can be reported.
      494a39ed
    • Damian Johnson's avatar
      Connection details usually not visible · f6cbc8d6
      Damian Johnson authored
      The 'width' attribute already takes into account the initial 'x' offset, but in
      the conditional we didn't account for that causing connection details to just
      about never be shown.
      f6cbc8d6
    • Damian Johnson's avatar
      Alias ERR for ERROR and WARN for WARNING · e0a813df
      Damian Johnson authored
      Fixing a couple easy to make gotchas in our --log argument. It's especially
      confusing becuase nyx expected 'NYX_WARNING' whereas it displayed 'NYX_WARN'.
      e0a813df
  2. Oct 29, 2017
  3. Oct 26, 2017
  4. Oct 25, 2017
  5. Oct 24, 2017
    • Damian Johnson's avatar
      Fix unit tests · c6c16ebc
      Damian Johnson authored
      Lots of breakages have slipped in while attempting to improve our performance.
      Most were timing related due to our switch to static sleeps.
      c6c16ebc
  6. Oct 23, 2017
    • Damian Johnson's avatar
      Add arrow image · 66e3df73
      Damian Johnson authored
      Oops! Forgot to add a couple small image resources.
      66e3df73
    • Damian Johnson's avatar
      Add a contact webpage · f55b0c25
      Damian Johnson authored
      Simple page listing our relay support channels (email list, irc, trac, and me).
      f55b0c25
    • Damian Johnson's avatar
      Website menu with less common pages · 35614865
      Damian Johnson authored
      When looking at our site I just realized it's hard to figure out how to report
      bugs. It's in the FAQ, but who's gonna read that?
      
      Adding a 'more' dropdown menu with useful, but less common sections folks will
      want (changelog, bug tracker, and contact info for now). The contact page
      doesn't exist yet - that's next.
      
      God the styling on this was a pita. I'm really not sure why this negative
      margin is necessary but without it the rest of the nav menu gets pushed down.
      Stared for hours at this hoping to get something simpler but time to raise the
      flag and commit what works.
      
      I really hate the lack of a shared header, but can't say that alone is worth
      something like Hyde. :/
      35614865
  7. Oct 22, 2017
    • Damian Johnson's avatar
      Manually handle caching of connections · 964e9a7a
      Damian Johnson authored
      Connections shouldn't use a lru_cache. If the cache size is less than the
      number of connections we have at any point then we consume extra cpu, but if
      it's too high we consume more and more memory unnecessarily until it's filled.
      
      Instead evicting from the cache when a connection hasn't been referenced in a
      while.
      964e9a7a
  8. Oct 21, 2017
    • Damian Johnson's avatar
      Possible stacktrace when pausing · e2df6f3e
      Damian Johnson authored
      Interesting graph panel timing bug when draw's concurrently invoked before
      we've set stats_paused. Only seen it once, but simple to fix.
      
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 737, in draw
          func(_Subwindow(subwindow_width, subwindow_height, curses_subwindow))
        File "/home/atagar/Desktop/nyx/nyx/panel/graph.py", line 569, in _draw
          stat = self._stats_paused[self._displayed_stat]
        TypeError: 'NoneType' object has no attribute '__getitem__'
      e2df6f3e
    • Damian Johnson's avatar
      Don't use lru_cache for connection entry attributes · 52216d69
      Damian Johnson authored
      Interesting. The lru_cache for from_connection works, but the ones for the
      methods don't. This causes truly horrid performance when you have a ton of
      connections since it's recalculating the type and lines with every redraw.
      52216d69
  9. Oct 15, 2017
    • Damian Johnson's avatar
      Cpu usage pegged when paused · 523a1f5e
      Damian Johnson authored
      When paused daemon updates turned into a busy loop, pegging the cpu. Actually,
      I'm unsure why we're checking the paused status at all since daemons still run
      in the background.
      523a1f5e
    • Damian Johnson's avatar
      Fix graph panel deadlock · 9978fd0f
      Damian Johnson authored
      Replacing stat cloning with a simple lock bought us some performance
      improvement but it also introduced a deadlocking issue. If redraw is called
      while we're updating a stat the interface freezes. This can be easily
        sidestepped by only locking for the stat update and not including the redraw
        call.
      9978fd0f
  10. Oct 11, 2017
    • Damian Johnson's avatar
      Don't resolve tor's cwd for relative paths · b8ce3ce0
      Damian Johnson authored
      Tor's DisableDebuggerAttachment feature breaks all methods we attempt to get
      tor's cwd (/proc, pwdx, and lsof). However, this is fine since we only need the
      cwd to expand relative paths which doesn't come up much (iirc tor makes more
      effort nowadays to give only absolute paths).
      
      Skipping cwd resolution if a path's relative so we avoid the doomed system
      calls.
      b8ce3ce0
    • Damian Johnson's avatar
      Fetch address at a fixed rate · 41079dce
      Damian Johnson authored
      Stem transparently caches immutable information but our address is a rather
      strange critter. It can change but hardly ever does, and is used quite a bit.
      
      Nyx forced Stem to treat this as being cachable but when our address is
      unavailable this still accounted for numerous requests. Instead fetching
      the our address at a fixed rate of once a minute.
      
      This provides two benefits...
      
      * Avoid pointless requests while there's no network available.
      * This way we'll evenually update our address if it changes while running.
      41079dce
    • Damian Johnson's avatar
      Interpreter scrolling off by one · 85591ab9
      Damian Johnson authored
      When the interpreter panel has content the scollbar doesn't report itself as
      being at the bottom.
      85591ab9
  11. Sep 30, 2017
    • Damian Johnson's avatar
      Replace pause conditionals with sleep · 2bac3dc5
      Damian Johnson authored
      Threading conditionals are the proper method of doing an interruptable sleep,
      so nyx can shut down right away when quit. However, each of these conditionals
      impose a surprisingly high tax in terms of baseline cpu usage. Fully half the
      cpu when idle is just spent on checking conditionals. Guess they're implemented
      with some sort of busy puller...
      
      We don't need interruptability. It's nice, but having our interface take a
      fraction of a second is well worth halving our cpu usage. When idle this change
      drops cpu usage from 2.1% to 1.1% for me.
      
        Pause   Cpu
        0.1s    1.4%
        0.2s    1.3%
        0.3s    1.2%
        0.4s    1.1%
        0.5s    1.1%
        0.6s    1.1%
      2bac3dc5
    • Damian Johnson's avatar
      Only determine relay ports once · 1f9ef690
      Damian Johnson authored
      No detectable difference when I lack any connections, but constructing this
      lists with every connection entry is silly (even if it is cached). Constructing
      a set once instead for constant time lookups.
      1f9ef690
  12. Sep 29, 2017
    • Damian Johnson's avatar
      Lessen overhead of idle daemon panels · e82ed8c5
      Damian Johnson authored
      Turns out having a daemon panel reacquire a lock every 0.2 seconds is fairly
      taxing, even if the panel isn't doing anything. That, and having the log panel
      every 0.3 seconds is kinda silly. This drops the log panel usage when idle by
      80% (0.5% to 0.1% on my system).
      e82ed8c5
    • Damian Johnson's avatar
      Update graph title more infrequently · 59048949
      Damian Johnson authored
      There's no point in fetching graph title stats every second. These change on an
      hourly basis. Caching this and skipping vline when there's nothing to display
      drops our cpu usage when idle by 70% (from 1% to 0.3% on my system).
      59048949
  13. Sep 27, 2017
    • Damian Johnson's avatar
      Redraw right away when actions are taken · 2f7c5283
      Damian Johnson authored
      Unnecessarily providing the 'forced' flag when redrawing can cause screen
      flickering, but omitting it causes actions to not be visible. For instance,
      when the relay is inactive changing pages takes seconds to appear.
      2f7c5283
  14. Sep 24, 2017
    • Damian Johnson's avatar
      Fix lsof line detection for usage of ports · df9cd999
      Damian Johnson authored
      My relay complains with...
      
        19:13:35 [NYX_INFO] Failed three attempts to determine the process using
        active ports (unrecognized output from lsof (lines are expected to have ten
        fields: COMMAND PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME): COMMAND
        PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME)
      
      This is because there's a single space after 'COMMAND' rather than two, causing
      us not to omit the title line from parsing. Making this less strict.
      df9cd999
    • Damian Johnson's avatar
      Bump connection cache size · b18c4677
      Damian Johnson authored
      Finally got it! The connection panel's performance relies on heavily reusing
      cached resources. However, on my moderately busy relay I have 2000 connections
      whereas lur_cache's default size is only 250. This caused us to constantly
      evict and recreate resources every five seconds. This change drops the nyx cpu
      usage for me from 28% to 16%.
      b18c4677
    • Damian Johnson's avatar
      3fc8251c
  15. Sep 22, 2017
    • Damian Johnson's avatar
      Make deduplication a constant time operation · 4acc68d5
      Damian Johnson authored
      At only INFO runlevel cpu usage on my relay jumps from 13% to 20%. This is
      entirely coming from deduplication. We made this far more efficient (linear
      from n^2) but it's pretty easy to finish dropping this down to a constant
      time operation.
      4acc68d5
  16. Sep 16, 2017
    • Damian Johnson's avatar
      Reduce graph panel cpu usage · c02be3ee
      Damian Johnson authored
      Our graph panel updates and redraws itself every second, making it a
      non-trivial load on cpu. Two actions in particular account for most of
      it...
      
        * Cloning stats on every redraw. This constantly consumes 0.3% cpu on my
          relay. Being lock-free is nice, but in this case a lock really makes
          sense.
      
        * Performing a flurry of addstr calls for each cell in the graph. Doing
          a single vline call for each column instead drops cpu by another 0.4%.
      
      On my relay this drops cpu usage of the graph panel from 1% to 0.4% (60%
      less)...
      
        * 0.3% cpu usage when only the header panel is rendered
        * 1.3% cpu usage when the graph panel was rendered too
        * 0.7% cpu usage when the graph panel was rendered with these changes
      c02be3ee
    • Damian Johnson's avatar
      Stacktrace if all panels are disabled · 148e2137
      Damian Johnson authored
      If the nyxrc disables all our panels except the header then we crash with...
      
        Traceback (most recent call last):
          File "/home/ubuntu/nyx/run_nyx", line 14, in <module>
            nyx.main()
          File "/home/ubuntu/nyx/nyx/__init__.py", line 137, in main
            nyx.starter.main()
          File "/home/ubuntu/nyx/stem/util/conf.py", line 289, in wrapped
            return func(*args, config = config, **kwargs)
          File "/home/ubuntu/nyx/nyx/starter.py", line 94, in main
            nyx.curses.start(nyx.draw_loop, acs_support = config.get('acs_support', True), transparent_background = True, cursor = False)
          File "/home/ubuntu/nyx/nyx/curses.py", line 216, in start
            curses.wrapper(_wrapper)
          File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
            return func(stdscr, *args, **kwds)
          File "/home/ubuntu/nyx/nyx/curses.py", line 214, in _wrapper
            function()
          File "/home/ubuntu/nyx/nyx/__init__.py", line 155, in draw_loop
            interface = nyx_interface()
          File "/home/ubuntu/nyx/nyx/__init__.py", line 217, in nyx_interface
            Interface()  # constructor sets NYX_INTERFACE
          File "/home/ubuntu/nyx/nyx/__init__.py", line 574, in __init__
            visible_panels = self.page_panels()
          File "/home/ubuntu/nyx/nyx/__init__.py", line 638, in page_panels
            return [self._header_panel] + self._page_panels[page_number]
        IndexError: list index out of range
      148e2137
  17. Sep 14, 2017
Loading