soft-pool: lock channel queue when trying to open new channels #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In
SFTPSoftChannelPool
we try to open as many SFTP channels as the server will allow (up to a default max of 10), and then cap our max if/when the server rejects a request to open an additional channel.Before this PR there was a bug where we could await multiple
client.start_sftp_client()
calls at once. If any of the calls which were rejected by the server, we would not account for the case that any of the other calls which were being awaited at the same time eventually succeeded (i.e. we could request something like 10 channels from the server at once, but the server would only allow us to open 1 and reject the other 9 requests). In this situation we would just fail as if the server had not allowed us to open any channels at all.In the soft channel pool we should only try to open a single channel at a time. (And then SFTP requests using those open channels can be done in parallel)
See iterative/dvc-ssh#16