Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#167 closed defect (fixed)

fatal AttributeError on startup with Twisted 10.2.0

Reported by: Zooko Owned by: Brian Warner
Priority: critical Milestone: 0.6.0
Component: negotiation Version: 0.5.1
Keywords: Cc:

Description

2010-11-29 21:56:17-0700 [-] Unhandled Error
        Traceback (most recent call last):
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0_r30364-py2.6-macosx-10.6-universal.egg/twisted/internet/_baseprocess.py", line 60, in maybeCallProcessEnded
            proto.processEnded(Failure(reason))
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0_r30364-py2.6-macosx-10.6-universal.egg/twisted/internet/utils.py", line 89, in processEnded
            self.deferred.callback(self.s.getvalue())
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0_r30364-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 361, in callback
            self._startRunCallbacks(result)
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0_r30364-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 455, in _startRunCallbacks
            self._runCallbacks()
        --- <exception caught here> ---
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0_r30364-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 542, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/Library/Python/2.6/site-packages/allmydata/node.py", line 328, in _setup_tub
            portnum = l.getPortnum()
          File "/Library/Python/2.6/site-packages/foolscap-0.5.1-py2.6.egg/foolscap/pb.py", line 74, in getPortnum
            return self.s._port.getHost().port
        exceptions.AttributeError: 'StreamServerEndpointService' object has no attribute '_port'
        

Change History (6)

comment:1 Changed 14 years ago by Brian Warner

Component: unknownnegotiation
Milestone: undecided0.6.0
Owner: set to Brian Warner
Status: newassigned

Ok, so it looks like TCPServer still behaves the same way it used to, but strports.service(port) now returns something other than a TCPServer. So the immediate solution is:

  • rewrite pb.Listener and don't use strports at all. That means manually parsing the subset of the strports spec that we care about ("tcp:", a port number, and maybe an :interface=a.b.c.d), and then constructing a TCPServer instance directly.
  • we're still peeking at the internals of TCPServer when we get its ._port attribute, but we can probably get away with that for another Twisted release or two.

The medium-term solution is to replace pb.Listener with a new IService class that manages its own reactor.listenTCP. We can add a getYerKernelAllocatedPortNumber method to it that's under our control. That might also make it easier to support IPv6, or not.

The long-term solution is to pester Glyph to finish and/or explain the new "endpoints" support, and see if it makes sense to use them instead of raw listenTCP. It sounds like endpoints might also make it easier to support Tor, or certain kinds of proxies. Or not.

comment:2 Changed 14 years ago by Brian Warner

[628c8eecdc3b3990d4082c095d8b01e7cd006a9f] ought to fix this.. please give it a spin. If it seems ok, I'll aim for a new Foolscap release later this week.

comment:3 Changed 14 years ago by Zooko

Works for me!

comment:5 Changed 14 years ago by Brian Warner

Resolution: fixed
Status: assignedclosed

Ok, marking this closed, the fix will be in the upcoming 0.6.0 release.

comment:6 in reply to:  4 Changed 14 years ago by davidsarah

Replying to zooko:

before [628c8eecdc3b3990d4082c095d8b01e7cd006a9f], after [628c8eecdc3b3990d4082c095d8b01e7cd006a9f]

Both of these appear to fail due to http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1286 , which is caused by the same change to Twisted, but the failure is in Tahoe (when creating a web-API server) rather than foolscap.

Note: See TracTickets for help on using tickets.