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

Rebased AsyncResult fix #1184

Merged

Conversation

Rob-Hague
Copy link
Collaborator

This is #680 by @miroslavpokorny brought up to date.

I have been seeing occasional failures of the Test_Sftp_Multiple_Async_Upload_And_Download_10Files_5MB_Each test.

When choosing "Run until failure" in Visual Studio, the test failed after 20, 9, 45, 32 and 10 attempts. With this change, it ran successfully over 300 times before I stopped it.

Fixes #329

Side note: I'm not really sure why these Begin/End methods have an extra "callback" parameter as well as an AsyncCallback parameter, but I'm hoping we can just get rid of these methods soon anyway, or at least have them wrap a task based implementation

@Rob-Hague
Copy link
Collaborator Author

I am seeing strange failures of this test locally. The failures are not the original "uploaded/downloaded bytes do not match" assertion, rather some kind of channel closed/timeout exception such as "Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out".

I thought I had narrowed it down and was able to reproduce the behaviour, but then it started behaving differently and now I have no idea what's going on.

@WojciechNagorski
Copy link
Collaborator

Can you remove this in this PR

Assert.Inconclusive("Uploaded and downloaded bytes should match, but test is not stable");

miroslavpokorny and others added 2 commits December 2, 2023 19:56
- AsyncResult should contain invalid value immediately after async operation is marked as completed
- there was race condition problems with callback method which is invoked on different thread so updating of value is done without any synchronization. So in some cases async operation is marked as completed but async result value is not yet updated and contains invalid value
@Rob-Hague
Copy link
Collaborator Author

Thanks, I had done that locally but forgot to push...

@WojciechNagorski WojciechNagorski marked this pull request as ready for review December 4, 2023 05:00
@WojciechNagorski
Copy link
Collaborator

@Rob-Hague It looks like it works. Is it ready for review?

@Rob-Hague
Copy link
Collaborator Author

Yes I think so, I think there were gremlins in my PC

@WojciechNagorski WojciechNagorski merged commit 6d9d032 into sshnet:develop Dec 4, 2023
1 check passed
@Rob-Hague Rob-Hague deleted the FixAsyncResultInvalidValue branch December 4, 2023 08:55
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.

UploadedBytes wrong value
3 participants