test failures with message "exceptions.AttributeError: 'StreamServerEndpointService' object has no attribute '_port'", and failure to write node.url file with Twisted 10.2 #1286
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#1286
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
(http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/264/steps/test/logs/stdio)
I'll refrain from speculation in the ticket Description, except to say that this may be specific to Twisted 10.2.
OK, here's the speculation.
The exception is thrown from source:src/allmydata/test/no_network.py@4657#L290:
where the
.listener
variable was set at source:src/allmydata/webish.py@4672#L152:On Twisted trunk-at-time-of-writing (latest release 10.2),
strports.service
is defined here. Notice that it returns an instance of StreamServerEndpointService. Prior to Twisted changeset 30155, it returned an instance of some other dynamically-chosen Server class.Neither
StreamServerEndpointService
nor its superclass Service have a_port
instance variable. From instrumentingwebish.py
and running with Twisted 10.0, thelistener
was previously an instance oftwisted.application.internet.TCPServer
, which inherits from _AbstractServer, which does have a_port
variable.I think this should only affect tests, since Tahoe does not reference
_port
in any non-test code.Replying to davidsarah:
I'm mistaken;
webish.py
references_port
in its [_write_nodeurl_file]source:src/allmydata/webish.py@4676#L163 callback method. That method also depends incorrectly on thelistener
being an instance oftwisted.application.internet.{TCPServer,SSLServer
}.test failures with message "exceptions.AttributeError: 'StreamServerEndpointService' object has no attribute '_port'"to test failures with message "exceptions.AttributeError: 'StreamServerEndpointService' object has no attribute '_port'", and failure to write node.url file with Twisted 10.2Brian suggested that this was the same bug as http://foolscap.lothar.com/trac/ticket/167 . It's certainly caused by the same change to Twisted, but I think that Tahoe needs an independent fix (as well as being updated to require foolscap 0.6.0). Note that the problem in this ticket occurs when starting a web-API server, not a storage server.
Attachment ugly-fix-for-1286.darcs.patch (8591 bytes) added
Ugly, ugly fix for #1286. There must be a better way than relying on internal _-prefixed variables in Twisted. Lacks tests, do not apply yet.
changeset:c82b48f3d60fdfbc updates the foolscap version requirement to 0.6.0. zomp is off-line right now, but I don't expect that update to fix this ticket.
oops, yes, I think this is a separate instance of the problem in foolscap#167. I think we can get away with using the same solution: roll our own
strports()
parser, but keep usingTCPServer
(and keep relying upon the internal._port
attribute). The fix is harder than for Foolscap, however, because we were using thestrports
parser to make our webapi SSL capable: the new parser we write needs to also handle thekeyfile=
or whatever magic argument turned on SSL.zomp is back, and indeed it still fails:
http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/271/steps/test/logs/stdio
I think the original patch isn't correct because it is only getting the port as parsed from the strport specification, which may be zero, not the actual port on which we are listening. (The existing tests seem not to be sufficiently complete to catch that.)
Attachment 1286.diff (6719 bytes) added
functioning patch: tolerate 10.2 and earlier versions
The
_ and _ or _
syntax is Python 2.5+. Otherwise LGTM.(warner convinced me that there was no possibility of plan interference from calling
.callback
and.errback
synchronously.)In changeset:09a2241471c56f0a:
Reading over this patch again, some cleanups are possible:
The Deferred in
self._started
to which_write_nodeurl_file
is added as a callback, is fired just after settingself._url
. So the "if self._url:
" test in_write_nodeurl_file
is not needed. (If we usegetURL()
, the code will assert if there is any bug that makes me wrong about this, causing an error to be logged.)We can use
fileutil.write
instead of open+write. Also it's clearer to make the_write_nodeurl_file
a local function rather than a method.The comment "# this file is world-readable" is wrong in general; it will have the default permissions for files created by the node process (or the permissions are not changed if the file already exists).
Finally,
.listener
is intended to be private so it should probably be._listener
.Attachment webish-cleanup.darcs.patch (18190 bytes) added
rc/allmydata/webish.py: clean-ups and correction to a comment. Also change an open and write to use fileutil.write. See ref #1286 comment 13.
webish-cleanup.darcs.patch looks good to me!
In [4979/ticket1306]: