avoid calling req.finish() on closed HTTP connections #1366
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
4 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#1366
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
While reviewing #393 MDMF, I ran into some test failures which were related to an HTTP "GET" connection being closed by the client before the tahoe server had a chance to close it itself. I think it only occurs during the new tests added as part of the #393 patch, but it's not MDMF-specific.
Here's a patch to fix it. Note that Twisted-9.0 was the first version which started raising an error when you call
request.finish()
on a request that's already been closed, and it was also the first version to offerrequest.notifyFinish()
to tell you when it's been closed. So this patch has to switch onhasattr(req, "notifyFinish")
until the time we raise our dependency on Twisted to 9.0 or later.Attachment 1366.dpatch (3485 bytes) added
patch to avoid test failures with the #393 tests, but appropriate for trunk
Could this have been related to #1278 (gateway won't serve any page; variety of interesting error messages in twistd.log)?
Looks good to me. (I only eyeballed it, I didn't run it.)
Replying to zooko:
That does look likely given the log message on #1278:
+1 on 1366.dpatch . I would appreciate it if you could investigate #1278. Hopefully this fixes it! I seem to recall that it would happen when there were failures e.g. due to insufficient servers, and it looks like that might have gotten the Tahoe-LAFS web code into a bad state when Twisted >= 9.0 raised an exception from the Tahoe-LAFS web code's attempt to finish an already-finished connection, and that then the Tahoe-LAFS web code might have been unable to serve other requests after that.
Again, please remove the
reviewed
tag once you've pushed this patch to trunk (or suggest a different way to track that information).Replying to [davidsarah]comment:5:
If my theory from comment:82800 looks sufficiently likely to you then perhaps we should close #1278 as "MIA--presumed dead". It wasn't very reproducible by me -- perhaps there is an element of race condition between Twisted finishing the connection and Tahoe-LAFS finishing it ?
In changeset:44466fbb1bad4ba0:
The main bug in this ticket is fixed for 1.9. However since the Twisted dependency has been raised to >= 10.1, the
hasattr
switch is no longer needed.Attachment 1366-no-hasattr.darcs.patch (7596 bytes) added
web/filenode.py: since we depend on Twisted >= 10.1, there is no need to check for the existence of 'req.notifyFinish', which was added in Twisted 9.0. closes #1366
In changeset:587e31a8cf486031:
In [5507/ticket999-S3-backend]:
I see similar behavior, but after briefly skimming the patches and assuming that
filenode.py
was specific to only some HTTP requests, I filed a new ticket: #1664