twisted / twisted/twisted

twisted.conch.ssh.connection.openChannel, etc., should fail when not connected

Open
#9,626 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug conch new priority-normal
Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

wiml's avatar @wiml reported
Trac ID trac#9626
Type defect
Created 2019-04-14 23:46:47Z

Referencing this review comment: https://github.com/twisted/twisted/pull/1119#discussion_r272452722

In particular, when a service is in the process of being stopped, it shouldn't be possible to start more activities on the service. (In the reviewed code the risk that markrwilliams points out is that it could cause an infinite loop; another possibility is that an application would just hang similarly to what is described in trac ticket:9572).

I think a reasonable fix would be to set a new ivar _stopping to True at the top of serviceStopped(), and check it in the relevant methods: sendGlobalRequest, openChannel, sendRequest. Then raise ConnectionLost (or another more specific exception?).

Other methods (like sendEOF, sendClose, etc) should maybe just return early if _stopping (similar to how transports ignore write at that point), or maybe that should be the responsibility of the channel instance to handle.

Searchable metadata
trac-id__9626 9626
type__defect defect
reporter__wiml wiml
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__new new
resolution__None None
component__conch conch
keywords__None None
time__1555285607201087 1555285607201087
changetime__1555285607201087 1555285607201087
version__None None
owner__None None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at serviceStopped() and the relevant Conch methods: sendGlobalRequest, openChannel, and sendRequest. Check how shutdown state is represented and determine the appropriate failure exception; done means these operations fail once stopping begins, while shutdown-related methods such as sendEOF and sendClose behave consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.