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

Download/Connection Performance degrades over time #108

Closed
RLDWV2003 opened this issue Jan 12, 2020 · 9 comments
Closed

Download/Connection Performance degrades over time #108

RLDWV2003 opened this issue Jan 12, 2020 · 9 comments

Comments

@RLDWV2003
Copy link

Currently using 4.9.4. Monitoring a Dropbox account every 30 seconds looking for new files. Files come in from multiple sources, usually only 128 bytes in size, but occasionally can be much larger - 5-10 megabytes. Everything works fine for hours, but after 12-16 hours it starts to see socket errors and slows down. Request to download files must be made multiple times on many occasions, and ultimately it pauses and fails. While it's failing the files start to pile up, and it only gets worse. Killing and restarting my C# application doesn't have any effect. If I reboot my PC, it works great again - for 12-16 hours, then it starts. CPU/memory are not an issue. Comcast speeds show around 750MBps (though that is probably BS). Could there be a resource issue, or something I'm not doing?
I'm essentially doing a ListFolderAsync every 30 seconds, using DownloadAsync() to get any files, and DeleteV2Async() after I've retrieved it. I use the same DropboxClient object every time. It could be something in my code, but you would think that killing/restarting it would make the problem go away, which it doesn't. Only rebooting the computer fixes it. Thoughts? (Thanks in advance!)

@greg-db
Copy link
Contributor

greg-db commented Jan 13, 2020

[Cross-linking for reference: https://www.dropboxforum.com/t5/API-Support-Feedback/Slow-degradation-of-Performance-Retrieving-Files/m-p/388999#M21564 ]

Thanks for the report! Nothing immediately comes to mind unfortunately, and I can't seem to find any other reports of issues like this, so we'll need to look into it more.

Can you share some actual code snippets and the full error output? Thanks in advance!

@RLDWV2003
Copy link
Author

Sorry for the late reply - was travelling all last week. During these travels, I never saw this behavior, so I'm starting to suspect my Comcast network connection here in my home office. If/when it happens again I'll provide source and more detailed error codes. Thanks!
Bob

@greg-db
Copy link
Contributor

greg-db commented Jan 20, 2020

Thanks for letting us know! I'll close this in that case, but feel free to re-open if you find something with the SDK.

@greg-db greg-db closed this as completed Jan 20, 2020
@RLDWV2003
Copy link
Author

It may have to do with creating/deleting the Dropbox objects so many times during development/debugging. Here's a bit of the code:

var response = DBClient.Files.DownloadAsync(DropboxFolderPath + "/" + DropboxFileName);
var fileStream = System.IO.File.Create(DownloadFolderPath + DownloadFileName);
response.Result.GetContentAsStreamAsync().Result.CopyTo(fileStream);
fileStream.Close();
fileStream.Dispose();

The error I get periodically is:

"The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."
TargetSite ThrowForNonSuccess(System.Threading.Tasks.Task)

Running Windows 10.

@greg-db
Copy link
Contributor

greg-db commented Jan 21, 2020

Thanks for following up with the additional information. To clarify though, at this point have you found that is or isn't specific to your Comcast network connection?

Also, when you say you get this error periodically, how often (e.g., as a percent of API calls attempted) is that, and on which line does that occur? Also, if there is more to that error output, e.g., a stack, please share that as well.

@RLDWV2003
Copy link
Author

The comfortable answer for me is to blame Comcast. But if they're the culprit, then rebooting my PC shouldn't make it work perfectly again. I think the reason I didn't see it while on travel is because I was only using my app that monitors and downloads, not developing it. The Dropbox object only gets created/destroyed about 5 times a day vs. ~75 times a day when I'm developing the communications app in Visual Studio. I'll definitely try to provide more details next time it happens. Thanks again.

@RLDWV2003
Copy link
Author

OK, had the app running all night. Worked great from 4 PM to 2 AM. Then the errors started:

public bool Download(string DropboxFolderPath, string DropboxFileName, string DownloadFolderPath, string DownloadFileName)
{
try
{
var response = DBClient.Files.DownloadAsync(DropboxFolderPath + "/" + DropboxFileName);
var fileStream = System.IO.File.Create(DownloadFolderPath + DownloadFileName);
response.Result.GetContentAsStreamAsync().Result.CopyTo(fileStream);
fileStream.Close();
fileStream.Dispose();
return true;
}
catch (Exception ex)
{
Debug.Print("Error in DropBoxClient.Download: " + ex.Message.ToString());
return false;
}
}

DropBoxComms.exe!DropBoxComms.DropBoxBase.Download(string DropboxFolderPath, string DropboxFileName, string DownloadFolderPath, string DownloadFileName) Line 359 C#
DropBoxComms.exe!DropBoxComms.MainWindow.ReadDropBoxMessages(System.ComponentModel.BackgroundWorker bw, string sFolder) Line 202 C#
DropBoxComms.exe!DropBoxComms.MainWindow.bwSaveToDatabase_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) Line 82 C#
System.dll!System.ComponentModel.BackgroundWorker.OnDoWork(System.ComponentModel.DoWorkEventArgs e) Unknown
System.dll!System.ComponentModel.BackgroundWorker.WorkerThreadStart(object argument) Unknown

InnerException = {"The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."}

StackTrace =
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Dropbox.Api.DropboxRequestHandler.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.d__14`3.MoveNext()

Happy to provide anything else that will help. Is there a maximum number of API calls you're allowed to make to Dropbox per day? This runs on a 15 second interval.

@RLDWV2003
Copy link
Author

OK. Traced the problem to a bad NIC on my motherboard, hence the better behavior after a reboot. Changed to a different NIC and the problem is gone. Sorry for jerking everyone around ;-)

@greg-db
Copy link
Contributor

greg-db commented Jan 22, 2020

No problem, I'm glad to hear this is resolved. Thanks for letting us know!

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

No branches or pull requests

2 participants