Opened 8 years ago

Closed 8 years ago

#4503 closed defect (fixed)

TorBEL does not catch ErrorReply

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

Description

Traceback (most recent call last):
  File "/home/torbel/tor/TorCtl/TorCtl.py", line 712, in _eventLoop
    self._handleFn(timestamp, reply)
  File "/home/torbel/tor/TorCtl/TorCtl.py", line 1337, in _handle1
    self._map1.get(event.event_name, self.unknown_event)(event)
  File "/home/torbel/tor/torbel/controller.py", line 852, in stream_status_event
    self.conn.close_stream(event.strm_id, reason = 7)
  File "/home/torbel/tor/TorCtl/TorCtl.py", line 1196, in close_stream
    %(streamid, reason, "".join(flags)))
  File "/home/torbel/tor/TorCtl/TorCtl.py", line 868, in sendAndRecv
    raise ErrorReply("%s %s"%(tp, msg), status = code, message = msg)
ErrorReply: 552 Unknown stream "2432"

It looks like we just need to catch the ErrorReply.

Child Tickets

Change History (3)

comment:1 Changed 8 years ago by Sebastian

Summary: TorBEL does not catchTorBEL does not catch ErrorReply

comment:2 Changed 8 years ago by aagbsn

Status: newneeds_review

https://github.com/aagbsn/torbel/tree/4503-torbel-does-not-catch-errorreply

diff --git a/controller.py b/controller.py
index fe6dbf7..b94c79e 100644
--- a/controller.py
+++ b/controller.py
@@ -853,6 +853,12 @@ class Controller(TorCtl.EventHandler):
                 except TorCtl.TorCtlClosed:
                     # Bail if we closed.
                     return
+                except TorCtl.ErrorReply, e:
+                    # We can receive "552 Unknown stream" if Tor pukes on the stream
+                    # before we actually receive the event and use it.
+                    log.error("(%s, %d): Error attaching stream!",
+                              router.nickname, event.target_port)  
+                    return
 
                 if narrow:
                     self.narrow(stream.router, event.target_port)

comment:3 Changed 8 years ago by Sebastian

Resolution: fixed
Status: needs_reviewclosed

merged, thanks!

Note: See TracTickets for help on using tickets.