twisted.conch.ssh.filetransfer.FileTransferClient._sendRequest will wait forever for server to respond
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 10
Description
| @adiroiban reported | |
|---|---|
| Trac ID | trac#9569 |
| Type | defect |
| Created | 2019-01-05 08:31:16Z |
When a SFTP client request is done, Twisted will make the request and naively wait forever for the server to respond.
The code is here https://github.com/twisted/twisted/blob/eb2aaeb5d8e95ad1c4ec1889855d9cd151f696e2/src/twisted/conch/ssh/filetransfer.py#L530
With bogus servers or under very low networks it might takes a long to respond... and I expect that most users of Twisted SFTP client will not want to wait for that long.
I am suggesting to use a 60 seconds timeout deferred, instead of the normal deferred here
_scheduler = reactor
def _sendRequest(self, msg, data):
data = struct.pack('!L', self.counter) + data
d = defer.Deferred()
d.addTimeout(60, self._scheduler)
self.openRequests[self.counter] = d
self.counter += 1
self.sendPacket(msg, data)
return d
What do you think?
Searchable metadata
trac-id__9569 9569
type__defect defect
reporter__adiroiban adiroiban
priority__normal normal
milestone__None None
branch__
branch_author__
status__new new
resolution__None None
component__conch conch
keywords__None None
time__1546677076927112 1546677076927112
changetime__1546896431314958 1546896431314958
version__None None
owner__None None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/twisted/conch/ssh/filetransfer.py at FileTransferClient._sendRequest, the entry point identified in the issue. Review how openRequests and Deferred responses are handled, then verify that an unresponsive SFTP server no longer leaves the request waiting forever and that normal responses still complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100