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

Verify SFTP retries when dealing with peer resets #1452

Merged
merged 2 commits into from Apr 24, 2022

Conversation

lcobucci
Copy link
Contributor

@lcobucci lcobucci commented 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 #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.

@lcobucci
Copy link
Contributor Author

@frankdejonge I'm not sure how these changes affect the FTP (not SFTP) tests... is it possible we're dealing with flaky stuff (considering the other tests have passed)?

@frankdejonge
Copy link
Member

@lcobucci yeah, those FTP containers are very unstable. I've implemented automatic retry mechanisms, but even then sometimes it's not good enough... I'll rerun the failed ones.

This introduces a proxy that simulates different network issues and a
client to manage it. That is handy to be able to test for issues that
can only be reproduced in specific scenarios/environments.

The management API provided here is slimmed down to only reproduce peer
resets but can be further extended if/when necessary.

More information: https://github.com/shopify/toxiproxy
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 frankdejonge merged commit e902df6 into thephpleague:2.x Apr 24, 2022
@lcobucci lcobucci deleted the add-test-for-sftp-retries branch April 25, 2022 06:17
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.

None yet

2 participants