[tor-commits] [nyx/master] Fix graph panel deadlock

atagar at torproject.org atagar at torproject.org
Tue Oct 17 18:51:21 UTC 2017


commit 9978fd0f37ebb8a295d57f60cb54f16f40955c6e
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Oct 15 08:20:54 2017 -0700

    Fix graph panel deadlock
    
    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.
---
 nyx/panel/graph.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/nyx/panel/graph.py b/nyx/panel/graph.py
index f62ce55..07fc93b 100644
--- a/nyx/panel/graph.py
+++ b/nyx/panel/graph.py
@@ -601,12 +601,12 @@ class GraphPanel(nyx.panel.Panel):
       for stat in self._stats.values():
         stat.bandwidth_event(event)
 
-      if self._displayed_stat:
-        param = self._stats[self._displayed_stat]
-        update_rate = INTERVAL_SECONDS[self._update_interval]
+    if self._displayed_stat:
+      param = self._stats[self._displayed_stat]
+      update_rate = INTERVAL_SECONDS[self._update_interval]
 
-        if param.primary.tick % update_rate == 0:
-          self.redraw()
+      if param.primary.tick % update_rate == 0:
+        self.redraw()
 
 
 def _draw_subgraph(subwindow, data, x, width, height, bounds_type, interval, color, fill_char = ' '):





More information about the tor-commits mailing list