Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SFTP retry mechanism #1451

Merged
merged 2 commits into from Apr 21, 2022
Merged

Conversation

lcobucci
Copy link
Contributor

As of phpseclib v3 RuntimeException objects are thrown, causing the whole retry logic to be bypassed.

This makes sure to re-attempt to connect when timeout or connection issues happen.

FIxes #1450

This path can never be executed.
@lcobucci
Copy link
Contributor Author

I'll plan sometime to add tests to cover the issues I fixed 👍

@lcobucci lcobucci changed the base branch from 3.x to 2.x April 21, 2022 09:47
As of phpseclib v3 `RuntimeException` objects are thrown, causing the
whole retry logic to be bypassed.

This makes sure to re-attempt to connect when timeout or connection
issues happen.
@frankdejonge frankdejonge merged commit 8ce6dd9 into thephpleague:2.x Apr 21, 2022
@lcobucci lcobucci deleted the fix-sftp-retries branch April 21, 2022 15:10
lcobucci added a commit to lcobucci/flysystem that referenced this pull request Apr 21, 2022
This verifies that Flysystem SFTP adapter goes through all the
configured tries before throwing an `UnableToConnectToSftpHost`
exception.

Reverting the fix applied in
thephpleague#1451 makes the test to
fail due to a unexpected `RuntimeException`.

Applying this for phpseclib v2 is a bit tricky, though, due to the lack
of knowledge on what has happened in the flow (e.g. `false` is returned
when a connection cannot be established or when an authentication error
happened). To make it work, the adapter for that version would need to
verify if there's a connection or not all the time - which doesn't sound
very good to me.
lcobucci added a commit to lcobucci/flysystem that referenced this pull request Apr 22, 2022
This verifies that Flysystem SFTP adapter goes through all the
configured tries before throwing an `UnableToConnectToSftpHost`
exception.

Reverting the fix applied in
thephpleague#1451 makes the test to
fail due to an unexpected `RuntimeException`.

Applying this for phpseclib v2 is a bit tricky, though, due to the lack
of knowledge on what has happened in the flow (e.g. `false` is returned
when a connection cannot be established or when an authentication error
happened). To make it work, the adapter for that version would need to
verify if there's a connection or not all the time - which doesn't sound
very good to me.
frankdejonge pushed a commit to thephpleague/flysystem-sftp-v3 that referenced this pull request Apr 24, 2022
This verifies that Flysystem SFTP adapter goes through all the
configured tries before throwing an `UnableToConnectToSftpHost`
exception.

Reverting the fix applied in
thephpleague/flysystem#1451 makes the test to
fail due to an unexpected `RuntimeException`.

Applying this for phpseclib v2 is a bit tricky, though, due to the lack
of knowledge on what has happened in the flow (e.g. `false` is returned
when a connection cannot be established or when an authentication error
happened). To make it work, the adapter for that version would need to
verify if there's a connection or not all the time - which doesn't sound
very good to me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SFTP Adapter (phpseclib v3)] Retry mechanism doesn't work
2 participants